Index: unk/Doxyfile
===================================================================
--- /trunk/Doxyfile	(revision 486)
+++ 	(revision )
@@ -1,1218 +1,0 @@
-# Doxyfile 1.4.2
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-#       TAG = value [value, ...]
-# For lists items can also be appended using:
-#       TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
-# by quotes) that should identify the project.
-
-PROJECT_NAME           = PVO
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
-# This could be handy for archiving the generated documentation or 
-# if some version control system is used.
-
-PROJECT_NUMBER         = 
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
-# base path where the generated documentation will be put. 
-# If a relative path is entered, it will be relative to the location 
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY       = /DATA/SITAR_1/whi550/VO/PulsarVO/docs/doxygen
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
-# 4096 sub-directories (in 2 levels) under the output directory of each output 
-# format and will distribute the generated files over these directories. 
-# Enabling this option can be useful when feeding doxygen a huge amount of 
-# source files, where putting all generated files in the same directory would 
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS         = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
-# documentation generated by doxygen is written. Doxygen will use this 
-# information to generate all constant output in the proper language. 
-# The default language is English, other supported languages are: 
-# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, 
-# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, 
-# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, 
-# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, 
-# Swedish, and Ukrainian.
-
-OUTPUT_LANGUAGE        = English
-
-# This tag can be used to specify the encoding used in the generated output. 
-# The encoding is not always determined by the language that is chosen, 
-# but also whether or not the output is meant for Windows or non-Windows users. 
-# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES 
-# forces the Windows encoding (this is the default for the Windows binary), 
-# whereas setting the tag to NO uses a Unix-style encoding (the default for 
-# all platforms other than Windows).
-
-USE_WINDOWS_ENCODING   = NO
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
-# include brief member descriptions after the members that are listed in 
-# the file and class documentation (similar to JavaDoc). 
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC      = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
-# the brief description of a member or function before the detailed description. 
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF           = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator 
-# that is used to form the text in various listings. Each string 
-# in this list, if found as the leading text of the brief description, will be 
-# stripped from the text and the result after processing the whole list, is 
-# used as the annotated text. Otherwise, the brief description is used as-is. 
-# If left blank, the following values are used ("$name" is automatically 
-# replaced with the name of the entity): "The $name class" "The $name widget" 
-# "The $name file" "is" "provides" "specifies" "contains" 
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF       = 
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
-# Doxygen will generate a detailed section even if there is only a brief 
-# description.
-
-ALWAYS_DETAILED_SEC    = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
-# inherited members of a class in the documentation of that class as if those 
-# members were ordinary class members. Constructors, destructors and assignment 
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB  = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
-# path before files name in the file list and in the header files. If set 
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES        = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
-# can be used to strip a user-defined part of the path. Stripping is 
-# only done if one of the specified strings matches the left-hand part of 
-# the path. The tag can be used to show relative paths in the file list. 
-# If left blank the directory from which doxygen is run is used as the 
-# path to strip.
-
-STRIP_FROM_PATH        = 
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
-# the path mentioned in the documentation of a class, which tells 
-# the reader which header file to include in order to use a class. 
-# If left blank only the name of the header file containing the class 
-# definition is used. Otherwise one should specify the include paths that 
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH    = 
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
-# (but less readable) file names. This can be useful is your file systems 
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES            = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
-# will interpret the first line (until the first dot) of a JavaDoc-style 
-# comment as the brief description. If set to NO, the JavaDoc 
-# comments will behave just like the Qt-style comments (thus requiring an 
-# explicit @brief command for a brief description.
-
-JAVADOC_AUTOBRIEF      = YES
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
-# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
-# comments) as a brief description. This used to be the default behaviour. 
-# The new default is to treat a multi-line C++ comment block as a detailed 
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the DETAILS_AT_TOP tag is set to YES then Doxygen 
-# will output the detailed description near the top, like JavaDoc.
-# If set to NO, the detailed description appears after the member 
-# documentation.
-
-DETAILS_AT_TOP         = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
-# member inherits the documentation from any documented member that it 
-# re-implements.
-
-INHERIT_DOCS           = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
-# tag is set to YES, then doxygen will reuse the documentation of the first 
-# member in the group (if any) for the other members of the group. By default 
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC   = NO
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 
-# a new page for each member. If set to NO, the documentation of a member will 
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES  = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE               = 8
-
-# This tag can be used to specify a number of aliases that acts 
-# as commands in the documentation. An alias has the form "name=value". 
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
-# put the command \sideeffect (or @sideeffect) in the documentation, which 
-# will result in a user-defined paragraph with heading "Side Effects:". 
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES                = 
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
-# sources only. Doxygen will then generate output that is more tailored for C. 
-# For instance, some of the names that are used will be different. The list 
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C  = NO
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources 
-# only. Doxygen will then generate output that is more tailored for Java. 
-# For instance, namespaces will be presented as packages, qualified scopes 
-# will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA   = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
-# the same type (for instance a group of public functions) to be put as a 
-# subgroup of that type (e.g. under the Public Functions section). Set it to 
-# NO to prevent subgrouping. Alternatively, this can be done per class using 
-# the \nosubgrouping command.
-
-SUBGROUPING            = YES
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
-# documentation are documented, even if no documentation was available. 
-# Private class members and static file members will be hidden unless 
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL            = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
-# will be included in the documentation.
-
-EXTRACT_PRIVATE        = YES
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file 
-# will be included in the documentation.
-
-EXTRACT_STATIC         = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
-# defined locally in source files will be included in the documentation. 
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES  = YES
-
-# This flag is only useful for Objective-C code. When set to YES local 
-# methods, which are defined in the implementation section but not in 
-# the interface are included in the documentation. 
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS  = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
-# undocumented members of documented classes, files or namespaces. 
-# If set to NO (the default) these members will be included in the 
-# various overviews, but no documentation section is generated. 
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS     = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
-# undocumented classes that are normally visible in the class hierarchy. 
-# If set to NO (the default) these classes will be included in the various 
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES     = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
-# friend (class|struct|union) declarations. 
-# If set to NO (the default) these declarations will be included in the 
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS  = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
-# documentation blocks found inside the body of a function. 
-# If set to NO (the default) these blocks will be appended to the 
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS      = NO
-
-# The INTERNAL_DOCS tag determines if documentation 
-# that is typed after a \internal command is included. If the tag is set 
-# to NO (the default) then the documentation will be excluded. 
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS          = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
-# file names in lower-case letters. If set to YES upper-case letters are also 
-# allowed. This is useful if you have classes or files whose names only differ 
-# in case and if your file system supports case sensitive file names. Windows 
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES       = YES
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
-# will show members with their full class and namespace scopes in the 
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES       = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
-# will put a list of the files that are included by a file in the documentation 
-# of that file.
-
-SHOW_INCLUDE_FILES     = YES
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
-# is inserted in the documentation for inline members.
-
-INLINE_INFO            = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
-# will sort the (detailed) documentation of file and class members 
-# alphabetically by member name. If set to NO the members will appear in 
-# declaration order.
-
-SORT_MEMBER_DOCS       = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
-# brief documentation of file, namespace and class members alphabetically 
-# by member name. If set to NO (the default) the members will appear in 
-# declaration order.
-
-SORT_BRIEF_DOCS        = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
-# sorted by fully-qualified names, including namespaces. If set to 
-# NO (the default), the class list will be sorted only by class name, 
-# not including the namespace part. 
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the 
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME     = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or 
-# disable (NO) the todo list. This list is created by putting \todo 
-# commands in the documentation.
-
-GENERATE_TODOLIST      = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or 
-# disable (NO) the test list. This list is created by putting \test 
-# commands in the documentation.
-
-GENERATE_TESTLIST      = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or 
-# disable (NO) the bug list. This list is created by putting \bug 
-# commands in the documentation.
-
-GENERATE_BUGLIST       = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
-# disable (NO) the deprecated list. This list is created by putting 
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional 
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS       = 
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
-# the initial value of a variable or define consists of for it to appear in 
-# the documentation. If the initializer consists of more lines than specified 
-# here it will be hidden. Use a value of 0 to hide initializers completely. 
-# The appearance of the initializer of individual variables and defines in the 
-# documentation can be controlled using \showinitializer or \hideinitializer 
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES  = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
-# at the bottom of the documentation of classes and structs. If set to YES the 
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES        = YES
-
-# If the sources in your project are distributed over multiple directories 
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
-# in the documentation.
-
-SHOW_DIRECTORIES       = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that 
-# doxygen should invoke to get the current version for each file (typically from the 
-# version control system). Doxygen will invoke the program by executing (via 
-# popen()) the command <command> <input-file>, where <command> is the value of 
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file 
-# provided by doxygen. Whatever the progam writes to standard output 
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER    = 
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated 
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET                  = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are 
-# generated by doxygen. Possible values are YES and NO. If left blank 
-# NO is used.
-
-WARNINGS               = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED   = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
-# potential errors in the documentation, such as not documenting some 
-# parameters in a documented function, or documenting parameters that 
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR      = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for 
-# functions that are documented, but have no documentation for their parameters 
-# or return value. If set to NO (the default) doxygen will only warn about 
-# wrong or incomplete parameter documentation, but not about the absence of 
-# documentation.
-
-WARN_NO_PARAMDOC       = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that 
-# doxygen can produce. The string should contain the $file, $line, and $text 
-# tags, which will be replaced by the file and line number from which the 
-# warning originated and the warning text. Optionally the format may contain 
-# $version, which will be replaced by the version of the file (if it could 
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT            = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning 
-# and error messages should be written. If left blank the output is written 
-# to stderr.
-
-WARN_LOGFILE           = 
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain 
-# documented source files. You may enter file names like "myfile.cpp" or 
-# directories like "/usr/src/myproject". Separate the files or directories 
-# with spaces.
-
-INPUT                  = /DATA/SITAR_1/whi550/VO/PulsarVO/src
-
-# If the value of the INPUT tag contains directories, you can use the 
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
-# and *.h) to filter out the source-files in the directories. If left 
-# blank the following patterns are tested: 
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm
-
-FILE_PATTERNS          = 
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
-# should be searched for input files as well. Possible values are YES and NO. 
-# If left blank NO is used.
-
-RECURSIVE              = NO
-
-# The EXCLUDE tag can be used to specify files and/or directories that should 
-# excluded from the INPUT source files. This way you can easily exclude a 
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE                = 
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
-# directories that are symbolic links (a Unix filesystem feature) are excluded 
-# from the input.
-
-EXCLUDE_SYMLINKS       = NO
-
-# If the value of the INPUT tag contains directories, you can use the 
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
-# certain files from those directories.
-
-EXCLUDE_PATTERNS       = 
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or 
-# directories that contain example code fragments that are included (see 
-# the \include command).
-
-EXAMPLE_PATH           = 
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
-# and *.h) to filter out the source-files in the directories. If left 
-# blank all files are included.
-
-EXAMPLE_PATTERNS       = 
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
-# searched for input files to be used with the \include or \dontinclude 
-# commands irrespective of the value of the RECURSIVE tag. 
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE      = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or 
-# directories that contain image that are included in the documentation (see 
-# the \image command).
-
-IMAGE_PATH             = 
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should 
-# invoke to filter for each input file. Doxygen will invoke the filter program 
-# by executing (via popen()) the command <filter> <input-file>, where <filter> 
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
-# input file. Doxygen will then use the output that the filter program writes 
-# to standard output.  If FILTER_PATTERNS is specified, this tag will be 
-# ignored.
-
-INPUT_FILTER           = 
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
-# basis.  Doxygen will compare the file name with each pattern and apply the 
-# filter if there is a match.  The filters are a list of the form: 
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER 
-# is applied to all files.
-
-FILTER_PATTERNS        = 
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
-# INPUT_FILTER) will be used to filter the input files when producing source 
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES    = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
-# be generated. Documented entities will be cross-referenced with these sources. 
-# Note: To get rid of all source code in the generated output, make sure also 
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER         = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body 
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES         = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
-# doxygen to hide any special comment blocks from generated source code 
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS    = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES (the default) 
-# then for each documented function all documented 
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES (the default) 
-# then for each documented function all documented entities 
-# called/used by that function will be listed.
-
-REFERENCES_RELATION    = YES
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
-# will generate a verbatim copy of the header file for each class for 
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS       = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
-# of all compounds will be generated. Enable this if the project 
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX     = NO
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX    = 5
-
-# In case all classes in a project start with a common prefix, all 
-# classes will be put under the same header in the alphabetical index. 
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX          = 
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
-# generate HTML output.
-
-GENERATE_HTML          = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT            = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION    = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for 
-# each generated HTML page. If it is left blank doxygen will generate a 
-# standard header.
-
-HTML_HEADER            = 
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
-# each generated HTML page. If it is left blank doxygen will generate a 
-# standard footer.
-
-HTML_FOOTER            = 
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
-# style sheet that is used by each HTML page. It can be used to 
-# fine-tune the look of the HTML output. If the tag is left blank doxygen 
-# will generate a default style sheet. Note that doxygen will try to copy 
-# the style sheet file to the HTML output directory, so don't put your own 
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET        = 
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
-# files or namespaces will be aligned in HTML using tables. If set to 
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS     = YES
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
-# will be generated that can be used as input for tools like the 
-# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) 
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP      = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
-# be used to specify the file name of the resulting .chm file. You 
-# can add a path in front of the file if the result should not be 
-# written to the html output directory.
-
-CHM_FILE               = 
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
-# be used to specify the location (absolute path including file name) of 
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION           = 
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
-# controls if a separate .chi index file is generated (YES) or that 
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI           = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
-# controls whether a binary table of contents is generated (YES) or a 
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC             = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members 
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND             = NO
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
-# top of each HTML page. The value NO (the default) enables the index and 
-# the value YES disables it.
-
-DISABLE_INDEX          = NO
-
-# This tag can be used to set the number of enum values (range [1..20]) 
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE   = 4
-
-# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
-# generated containing a tree-like index structure (just like the one that 
-# is generated for HTML Help). For this to work a browser that supports 
-# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, 
-# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are 
-# probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW      = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
-# used to set the initial width (in pixels) of the frame in which the tree 
-# is shown.
-
-TREEVIEW_WIDTH         = 250
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
-# generate Latex output.
-
-GENERATE_LATEX         = YES
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT           = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
-# invoked. If left blank `latex' will be used as the default command name.
-
-LATEX_CMD_NAME         = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
-# generate index for LaTeX. If left blank `makeindex' will be used as the 
-# default command name.
-
-MAKEINDEX_CMD_NAME     = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
-# LaTeX documents. This may be useful for small projects and may help to 
-# save some trees in general.
-
-COMPACT_LATEX          = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used 
-# by the printer. Possible values are: a4, a4wide, letter, legal and 
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE             = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES         = 
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
-# the generated latex document. The header should contain everything until 
-# the first chapter. If it is left blank doxygen will generate a 
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER           = 
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
-# contain links (just like the HTML output) instead of page references 
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS         = NO
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
-# plain latex in the generated Makefile. Set this option to YES to get a 
-# higher quality PDF documentation.
-
-USE_PDFLATEX           = NO
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
-# command to the generated LaTeX files. This will instruct LaTeX to keep 
-# running if errors occur, instead of asking the user for help. 
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE        = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
-# include the index chapters (such as File Index, Compound Index, etc.) 
-# in the output.
-
-LATEX_HIDE_INDICES     = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
-# The RTF output is optimized for Word 97 and may not look very pretty with 
-# other RTF readers or editors.
-
-GENERATE_RTF           = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT             = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
-# RTF documents. This may be useful for small projects and may help to 
-# save some trees in general.
-
-COMPACT_RTF            = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
-# will contain hyperlink fields. The RTF file will 
-# contain links (just like the HTML output) instead of page references. 
-# This makes the output suitable for online browsing using WORD or other 
-# programs which support those fields. 
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS         = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's 
-# config file, i.e. a series of assignments. You only have to provide 
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE    = 
-
-# Set optional variables used in the generation of an rtf document. 
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE    = 
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
-# generate man pages
-
-GENERATE_MAN           = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT             = man
-
-# The MAN_EXTENSION tag determines the extension that is added to 
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION          = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
-# then it will generate one additional man file for each entity 
-# documented in the real man page(s). These additional files 
-# only source the real man page, but without them the man command 
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS              = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will 
-# generate an XML file that captures the structure of 
-# the code including all documentation.
-
-GENERATE_XML           = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT             = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema, 
-# which can be used by a validating XML parser to check the 
-# syntax of the XML files.
-
-XML_SCHEMA             = 
-
-# The XML_DTD tag can be used to specify an XML DTD, 
-# which can be used by a validating XML parser to check the 
-# syntax of the XML files.
-
-XML_DTD                = 
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
-# dump the program listings (including syntax highlighting 
-# and cross-referencing information) to the XML output. Note that 
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING     = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
-# generate an AutoGen Definitions (see autogen.sf.net) file 
-# that captures the structure of the code including all 
-# documentation. Note that this feature is still experimental 
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF   = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
-# generate a Perl module file that captures the structure of 
-# the code including all documentation. Note that this 
-# feature is still experimental and incomplete at the 
-# moment.
-
-GENERATE_PERLMOD       = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX          = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
-# nicely formatted so it can be parsed by a human reader.  This is useful 
-# if you want to understand what is going on.  On the other hand, if this 
-# tag is set to NO the size of the Perl module output will be much smaller 
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY         = YES
-
-# The names of the make variables in the generated doxyrules.make file 
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
-# This is useful so different doxyrules.make files included by the same 
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX = 
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor   
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
-# evaluate all C-preprocessor directives found in the sources and include 
-# files.
-
-ENABLE_PREPROCESSING   = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
-# names in the source code. If set to NO (the default) only conditional 
-# compilation will be performed. Macro expansion can be done in a controlled 
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION        = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
-# then the macro expansion is limited to the macros specified with the 
-# PREDEFINED and EXPAND_AS_PREDEFINED tags.
-
-EXPAND_ONLY_PREDEF     = NO
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES        = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that 
-# contain include files that are not input files but should be processed by 
-# the preprocessor.
-
-INCLUDE_PATH           = 
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
-# patterns (like *.h and *.hpp) to filter out the header-files in the 
-# directories. If left blank, the patterns specified with FILE_PATTERNS will 
-# be used.
-
-INCLUDE_FILE_PATTERNS  = 
-
-# The PREDEFINED tag can be used to specify one or more macro names that 
-# are defined before the preprocessor is started (similar to the -D option of 
-# gcc). The argument of the tag is a list of macros of the form: name 
-# or name=definition (no spaces). If the definition and the = are 
-# omitted =1 is assumed. To prevent a macro definition from being 
-# undefined via #undef or recursively expanded use the := operator 
-# instead of the = operator.
-
-PREDEFINED             = 
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
-# this tag can be used to specify a list of macro names that should be expanded. 
-# The macro definition that is found in the sources will be used. 
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED      = 
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
-# doxygen's preprocessor will remove all function-like macros that are alone 
-# on a line, have an all uppercase name, and do not end with a semicolon. Such 
-# function macros are typically used for boiler-plate code, and will confuse 
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS   = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references   
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles. 
-# Optionally an initial location of the external documentation 
-# can be added for each tagfile. The format of a tag file without 
-# this location is as follows: 
-#   TAGFILES = file1 file2 ... 
-# Adding location for the tag files is done as follows: 
-#   TAGFILES = file1=loc1 "file2 = loc2" ... 
-# where "loc1" and "loc2" can be relative or absolute paths or 
-# URLs. If a location is present for each tag, the installdox tool 
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen 
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES               = 
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE       = 
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
-# in the class index. If set to NO only the inherited external classes 
-# will be listed.
-
-ALLEXTERNALS           = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
-# in the modules index. If set to NO, only the current project's groups will 
-# be listed.
-
-EXTERNAL_GROUPS        = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script 
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH              = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool   
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 
-# or super classes. Setting the tag to NO turns the diagrams off. Note that 
-# this option is superseded by the HAVE_DOT option below. This is only a 
-# fallback. It is recommended to install and use dot, since it yields more 
-# powerful graphs.
-
-CLASS_DIAGRAMS         = YES
-
-# If set to YES, the inheritance and collaboration graphs will hide 
-# inheritance and usage relations if the target is undocumented 
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS   = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
-# available from the path. This tool is part of Graphviz, a graph visualization 
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT               = NO
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
-# will generate a graph for each documented class showing the direct and 
-# indirect inheritance relations. Setting this tag to YES will force the 
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH            = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
-# will generate a graph for each documented class showing the direct and 
-# indirect implementation dependencies (inheritance, containment, and 
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH    = YES
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS           = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
-# collaboration diagrams in a style similar to the OMG's Unified Modeling 
-# Language.
-
-UML_LOOK               = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the 
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS     = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
-# tags are set to YES then doxygen will generate a graph for each documented 
-# file showing the direct and indirect include dependencies of the file with 
-# other documented files.
-
-INCLUDE_GRAPH          = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
-# documented header file showing the documented files that directly or 
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH      = YES
-
-# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will 
-# generate a call dependency graph for every global function or class method. 
-# Note that enabling this option will significantly increase the time of a run. 
-# So in most cases it will be better to enable call graphs for selected 
-# functions only using the \callgraph command.
-
-CALL_GRAPH             = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY    = YES
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
-# then doxygen will show the dependencies a directory has on other directories 
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH        = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT       = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be 
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH               = 
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that 
-# contain dot files that are included in the documentation (see the 
-# \dotfile command).
-
-DOTFILE_DIRS           = 
-
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
-# this value, doxygen will try to truncate the graph, so that it fits within 
-# the specified constraint. Beware that most browsers cannot cope with very 
-# large images.
-
-MAX_DOT_GRAPH_WIDTH    = 1024
-
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
-# this value, doxygen will try to truncate the graph, so that it fits within 
-# the specified constraint. Beware that most browsers cannot cope with very 
-# large images.
-
-MAX_DOT_GRAPH_HEIGHT   = 1024
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
-# graphs generated by dot. A depth value of 3 means that only nodes reachable 
-# from the root by following a path via at most 3 edges will be shown. Nodes 
-# that lay further from the root node will be omitted. Note that setting this 
-# option to 1 or 2 may greatly reduce the computation time needed for large 
-# code bases. Also note that a graph may be further truncated if the graph's 
-# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH 
-# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), 
-# the graph is not depth-constrained.
-
-MAX_DOT_GRAPH_DEPTH    = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
-# background. This is disabled by default, which results in a white background. 
-# Warning: Depending on the platform used, enabling this option may lead to 
-# badly anti-aliased labels on the edges of a graph (i.e. they become hard to 
-# read).
-
-DOT_TRANSPARENT        = NO
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 
-# files in one run (i.e. multiple -o and -T options on the command line). This 
-# makes dot run faster, but since only newer versions of dot (>1.8.10) 
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS      = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
-# generate a legend page explaining the meaning of the various boxes and 
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND        = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
-# remove the intermediate dot files that are used to generate 
-# the various graphs.
-
-DOT_CLEANUP            = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine   
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be 
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE           = NO
Index: unk/Makefile
===================================================================
--- /trunk/Makefile	(revision 486)
+++ 	(revision )
@@ -1,194 +1,0 @@
-BASE = ./src
-
-DEBUG=
-
-TEST = $(BASE)/tests
-
-INSTALLDIR = /u/whi550/bin
-
-HEADER = $(BASE)/pvo-header.o
-
-BLOCK = $(BASE)/pvo-block.o
-
-PSRFITS = $(BASE)/pvo-FITS.o\
-	$(BASE)/pvo-FITS-fileIO.o
-
-UTILS = $(BASE)/pvo-utils.o
-
-METADATA = $(BASE)/pvo-metadata.o
-
-ifeq ($(HOST), bilby)
- CFITSIODIR = /Users/whi550/lib
-# CFITSIOINC = -I/Users/whi550/include/cfitsio
- CFITSIOINC =#-I/Users/whi550/include
-# CFITSIOLIB = -L$(CFITSIODIR) -lcfitsio
- CFITSIOLIB = -lcfitsio
-else
- ifeq ($(DEBUG),-g)
-  CFITSIODIR = /DATA/SITAR_1/whi550/Packages/cfitsio-myHack-debug
- else
-  CFITSIODIR = /DATA/SITAR_1/whi550/Packages/cfitsio
- endif
- CFITSIOINC = -I$(CFITSIODIR)
- CFITSIOLIB = -L$(CFITSIODIR) -lcfitsio
-endif
-
-LIBS = $(CFITSIOLIB) -lm
-CINC=  $(CFITSIOINC)
-
-USE_PVO_HH = $(BASE)/pvoconesearch.o\
-	$(BASE)/pvotapesummary.o\
-	$(BASE)/pvoconvert.o\
-	$(BASE)/pvo-FITS.o\
-	$(BASE)/pvo-metadata.o\
-	$(BASE)/pvosummary.o
-
-USE_METADATA_HH = $(BASE)/pvo-metadata.o\
-	$(BASE)/pvosummary.o\
-	$(BASE)/pvoconesearch.o
-
-USE_HEADER_HH =  $(BASE)/pvoconvert.o\
-	$(BASE)/pvosummary.o\
-	$(BASE)/pvoconesearch.o\
-	$(BASE)/pvo-header.o\
-	$(BASE)/pvo-block.o\
-	$(BASE)/pvo-FITS.o\
-	$(BASE)/pvo-FITS-fileIO.o\
-	$(TEST)/headertest.o\
-	$(TEST)/blocktest.o\
-	$(TEST)/psrfitstest.o\
-	$(TEST)/testallheaders.o\
-	$(TEST)/testDataAccess.o
-
-USE_BLOCK_HH =  $(BASE)/pvoconvert.o\
-	$(BASE)/pvosummary.o\
-	$(BASE)/pvoconesearch.o\
-	$(BASE)/pvo-block.o\
-	$(BASE)/pvo-FITS.o\
-	$(BASE)/pvo-FITS-fileIO.o\
-	$(TEST)/psrfitstest.o\
-	$(TEST)/blocktest.o\
-	$(TEST)/testallheaders.o\
-	$(TEST)/testDataAccess.o 
-
-USE_UTILS_HH =  $(BASE)/pvoconvert.o\
-	$(BASE)/pvosummary.o\
-	$(BASE)/pvoconesearch.o\
-	$(BASE)/print_s70_data.o\
-	$(BASE)/pvo-utils.o\
-	$(BASE)/pvo-block.o\
-	$(BASE)/pvo-FITS.o\
-	$(BASE)/pvo-FITS-fileIO.o\
-	$(TEST)/blocktest.o\
-	$(TEST)/psrfitstest.o\
-	$(TEST)/testallheaders.o\
-	$(TEST)/testDataAccess.o\
-	$(TEST)/testFitsCreation.o\
-	$(TEST)/testFitsKeywords.o\
-	$(TEST)/testFitsBinTable.o
-
-USE_PSRFITS_HH = $(BASE)/pvoconvert.o\
-	$(BASE)/pvosummary.o\
-	$(BASE)/pvoconesearch.o\
-	$(BASE)/pvo-FITS.o\
-	$(BASE)/pvo-FITS-fileIO.o\
-	$(TEST)/psrfitstest.o\
-	$(TEST)/blocktest.o\
-	$(TEST)/testallheaders.o\
-	$(TEST)/testDataAccess.o\
-	$(TEST)/testFitsCreation.o
-
-all : pvoconvert pvosummary pvoconesearch pvotapesummary pvofixfilename
-
-pvoconvert : $(BASE)/pvoconvert.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS)
-	$(CXX) -o pvoconvert.x $(BASE)/pvoconvert.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(LIBS)
-
-install : pvoconvert pvosummary
-	cp pvoconvert.x $(INSTALLDIR)/pvoconvert
-	cp pvosummary.x $(INSTALLDIR)/pvosummary
-	cp pvoconesearch.x $(INSTALLDIR)/pvoconesearch
-
-pvosummary : $(BASE)/pvosummary.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(METADATA)
-	$(CXX) -o pvosummary.x $(BASE)/pvosummary.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(METADATA) $(LIBS)
-
-pvoconesearch : $(BASE)/pvoconesearch.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(METADATA)
-	$(CXX) -o pvoconesearch.x $(BASE)/pvoconesearch.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(METADATA) $(LIBS)
-
-pvosummary2 : $(BASE)/pvosummary-glob.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS)
-	$(CXX) -o pvosummary2.x $(BASE)/pvosummary-glob.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(LIBS)
-
-pvotapesummary : $(BASE)/pvotapesummary.o $(HEADER) $(BLOCK) $(UTILS)
-	$(CXX) -o pvotapesummary.x $(BASE)/pvotapesummary.o $(HEADER) $(BLOCK)  $(UTILS) $(LIBS)
-
-pvofixfilename : $(BASE)/pvofixfilename.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS)
-	$(CXX) -o pvofixfilename.x $(BASE)/pvofixfilename.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(LIBS)
-
-testNewPSRF : $(TEST)/testNewPsrfits.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS)
-	$(CXX) -o testNewPSRF.x $(TEST)/testNewPsrfits.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(LIBS)
-
-testMove : $(TEST)/testMoving.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS)
-	$(CXX) -o testMove.x $(TEST)/testMoving.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(LIBS)
-
-testhead : $(TEST)/headertest.o $(HEADER)
-	$(CXX) -o testhead.x $(TEST)/headertest.o $(HEADER)
-
-testblock : $(TEST)/blocktest.o $(HEADER) $(BLOCK) 
-	$(CXX) -o testblock.x $(TEST)/blocktest.o $(HEADER) $(BLOCK) 
-
-testpsrfits : $(TEST)/psrfitstest.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS)
-	$(CXX) -o testpsrfits.x $(TEST)/psrfitstest.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(LIBS)
-
-testfulls70 : $(TEST)/s70FullTest.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS)
-	$(CXX) -o testfulls70.x $(TEST)/s70FullTest.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(LIBS)
-
-testallhead : $(TEST)/testallheaders.o $(HEADER) $(BLOCK)
-	$(CXX) -o testallhead.x $(TEST)/testallheaders.o $(HEADER) $(BLOCK)
-
-testdata : $(TEST)/testDataAccess.o $(HEADER) $(BLOCK)
-	$(CXX) -o testdata.x $(TEST)/testDataAccess.o $(HEADER) $(BLOCK)
-
-testfits1 : $(TEST)/testFitsCreation.o $(BASE)/pvo-utils.o
-	$(CXX) -o testfits1.x $(TEST)/testFitsCreation.o $(BASE)/pvo-utils.o $(LIBS)
-
-testfits2 : $(TEST)/testFitsKeywords.o
-	$(CXX) -o testfits2.x $(TEST)/testFitsKeywords.o $(LIBS)
-
-testfits3 : $(TEST)/testFitsBinTable.o $(UTILS)
-	$(CXX) -o testfits3.x $(TEST)/testFitsBinTable.o $(UTILS) $(LIBS)
-
-testfits4 : $(TEST)/testFitsBinTableSml.o
-	$(CXX) -o testfits4.x $(TEST)/testFitsBinTableSml.o $(LIBS)
-
-testTime : $(TEST)/testTimeFormats.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS)
-	$(CXX) -o testTime.x $(TEST)/testTimeFormats.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(LIBS)
-
-s70 : $(BASE)/print_s70_data.cc $(UTILS)
-	$(CXX) -o s70.x $(BASE)/print_s70_data.cc $(UTILS)
-
-pm : $(BASE)/print_pm_data.cc
-	$(CXX) -o pm.x $(BASE)/print_pm_data.cc
-
-makeFake : $(TEST)/makeFakeData.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS)
-	$(CXX) -o makeFake.x $(TEST)/makeFakeData.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(LIBS)
-
-testAngSep : $(TEST)/testAngSepFunctions.cc
-	$(CXX) -c $(TEST)/testAngSepFunctions.cc -o $(TEST)/testAngSepFunctions.o -I/usr/local/pgplot -I$(DUCHAMP_CODE)/src -I $(BASE)
-	$(CXX) -o testAngSep.x $(TEST)/testAngSepFunctions.o $(BASE)/pvo-utils.o -lcpgplot -lpgplot -L/u/whi550/CubeFinder -lpng -L/usr/X11R6/lib -lX11 -lg2c
-
-$(USE_PVO_HH) : $(BASE)/pvo.hh
-$(USE_UTILS_HH) : $(BASE)/pvo-utils.hh
-$(USE_HEADER_HH) : $(BASE)/pvo-header.hh
-$(USE_BLOCK_HH) : $(BASE)/pvo-block.hh
-$(USE_PSRFITS_HH) : $(BASE)/pvo-FITS.hh
-$(USE_METADATA_HH) : $(BASE)/pvo-metadata.hh
-
-.cc.o:
-	$(CXX) $(DEBUG) -c $< $(CINC) -o $@
-
-.c.o:
-	$(CC) $(DEBUG) -c $< $(CINC) -o $@
-
-.tex:
-
-clean : 
-	rm -f $(BASE)/*.o $(TEST)/*.o 
Index: unk/Makefile.psr
===================================================================
--- /trunk/Makefile.psr	(revision 486)
+++ 	(revision )
@@ -1,34 +1,0 @@
-#-*-Makefile-*- helps emacs recognize this file as a Makefile
-
-LOCAL_ROOT = /psr/cvshome/man082
-include $(LOCAL_ROOT)/include/Makefile.standard
-
-# BINDIR = $(PSRHOME)/bin/$(LOGIN_ARCH)
- BINDIR = $(PSRHOME)/$(LOGIN_ARCH)/bin
-
-INCLUDES = pvo-FITS.hh  pvo-block.hh  pvo-header.hh  pvo-utils.hh  pvo-metadata.hh
-
-# This forces us to use the fitsio.h file in /psr/linux/include, which
-# is of a later version than /psr/packages/linux/include. This later
-# version is needed so that we can use the function fits_file_exists,
-# which is not present in CFITSIO versions before v.3
- INCFLAGS := -I$(PSRHOME)/$(LOGIN_ARCH)/include $(INCFLAGS)
-
-# Also fix the library so that we use the correct version.
- LDFLAGS := -L$(PSRHOME)/$(LOGIN_ARCH)/lib -lcfitsio #$(LDFLAGS)
-# LDFLAGS := $(LDFLAGS) -lcfitsio -lm
-
-PROGRAMS = pvoconvert.C pvosummary.C pvotapesummary.C pvoconesearch.C pvofixfilename.C
-
-pvoconvert.srcs = pvo-header.C  pvo-block.C  pvo-utils.C pvo-FITS.C  pvo-FITS-fileIO.C  
-
-pvosummary.srcs = pvo-header.C  pvo-block.C  pvo-utils.C pvo-FITS.C  pvo-FITS-fileIO.C  pvo-metadata.C
-
-pvotapesummary.srcs = pvo-header.C  pvo-block.C  pvo-utils.C 
-
-pvoconesearch.srcs = pvo-header.C  pvo-block.C  pvo-utils.C pvo-FITS.C  pvo-FITS-fileIO.C  pvo-metadata.C
-
-pvofixfilename.srcs = pvo-header.C  pvo-block.C  pvo-utils.C pvo-FITS.C  pvo-FITS-fileIO.C
-
-include $(LOCAL_ROOT)/include/Makefile.extended
-
Index: /trunk/data/templates/combinedtemplate.fits
===================================================================
--- /trunk/data/templates/combinedtemplate.fits	(revision 1)
+++ /trunk/data/templates/combinedtemplate.fits	(revision 1)
@@ -0,0 +1,15 @@
+SIMPLE  = T
+BITPIX  = 32
+NAXIS   = 2     / number of dimensions
+NAXIS1  = 10  / length of first axis
+NAXIS2  = 20  / length of second axis
+OBJECT  = NGC 253 / name of observed object
+  xtension = bintable
+  naxis2 = 40
+  ttype# = Name
+  tform# = 10a
+  ttype# = Npoints
+  tform# = j
+  ttype# = Rate
+  tunit# = counts/s
+  tform# = e
Index: /trunk/data/templates/psrheader.txt
===================================================================
--- /trunk/data/templates/psrheader.txt	(revision 1)
+++ /trunk/data/templates/psrheader.txt	(revision 1)
@@ -0,0 +1,807 @@
+SIMPLE  =                    T / file does conform to FITS standard
+BITPIX  =                    8 / number of bits per data pixel
+NAXIS   =                    0 / number of data axes
+EXTEND  =                    T / FITS dataset may contain extensions
+COMMENT   FITS (Flexible Image Transport System) format defined in Astronomy and
+COMMENT   Astrophysics Supplement Series v44/p363, v44/p371, v73/p359, v73/p365.
+COMMENT   Contact the NASA Science Office of Standards and Technology for the
+COMMENT   FITS Definition document #100 and other FITS information.
+COMMENT
+HDRVER  = '2.4             '   / Header version 
+DATE    = '                '   / File creation date (YYYY-MM-DDThh:mm:ss UTC)
+OBSERVER= '                '   / Observer name(s)
+PROJID  = '                '   / Project name
+TELESCOP= '                '   / Telescope name
+ANT_X   = *                    / [m] Antenna ITRF X-coordinate (D)
+ANT_Y   = *                    / [m] Antenna ITRF Y-coordinate (D)
+ANT_Z   = *                    / [m] Antenna ITRF Z-coordinate (D)
+FRONTEND= '                '   / Rx and feed ID
+FD_POLN = '                '   / LIN or CIRC
+FD_HAND = *                    / +/- 1. +1 is LIN:A=X,B=Y, CIRC:A=L,B=R (I)
+FD_SANG = *                    / [deg] FA of E vect for equal sig in A&B (E)
+FD_XYPH = *                    / [deg] Phase of A^* B for injected cal (E)
+BACKEND = '                '   / Backend ID
+BECONFIG= '                '   / Backend configuration file name
+BE_PHASE= *                    / 0/+1/-1 BE cross-phase:0 unknown,+/-1 std/rev
+BE_DCC  = *                    / 0/1 BE downconversion conjugation corrected
+TCYCLE  = *                    / [s] On-line cycle time (D)
+NRCVR   = *                    / Number of receiver channels (I)
+OBS_MODE= '                '   / (PSR, CAL, SEARCH)
+SRC_NAME= '                '   / Source or scan ID 
+COORD_MD= '                '   / Coordinate mode (J2000, Gal, Ecliptic, etc.)
+STT_CRD1= '                '   / Start coord 1 (hh:mm:ss.sss or ddd.ddd)
+STT_CRD2= '                '   / Start coord 2 (-dd:mm:ss.sss or -dd.ddd) 
+TRK_MODE= '                '   / Track mode (TRACK, SCANGC, SCANLAT)
+STP_CRD1= '                '   / Stop coord 1 (hh:mm:ss.sss or ddd.ddd)
+STP_CRD2= '                '   / Stop coord 2 (-dd:mm:ss.sss or -dd.ddd) 
+SCANLEN = *                    / [s] Requested scan length (E)
+FD_MODE = '                '   / Feed track mode - FA, CPA, SPA, TPA
+FA_REQ  = *                    / [deg] Feed/Posn angle requested (E)
+CAL_MODE= '                '   / Cal mode (OFF, SYNC, EXT1, EXT2)
+CAL_FREQ= *                    / [Hz] Cal modulation frequency (E)
+CAL_DCYC= *                    / Cal duty cycle (E)
+CAL_PHS = *                    / Cal phase (wrt start time) (E)
+STT_DATE= '                '   / Start UT date (YYYY-MM-DD)
+STT_TIME= '                '   / Start UT (hh:mm:ss)
+STT_IMJD= *                    / Start MJD (UTC days) (J - long integer)
+STT_SMJD= *                    / [s] Start time (sec past UTC 00h) (J)
+STT_OFFS= *                    / [s] Start time offset (D)   
+STT_LST = *                    / [s] Start LST (D)
+END
+#
+###############################################################################
+#
+# Processing History Binary Table Extension
+#
+###############################################################################
+#
+XTENSION= BINTABLE             / ***** Processing history *****
+BITPIX  =                    8 / N/A
+NAXIS   =                    2 / 2-dimensional binary table
+NAXIS1  =                    * / width of table in bytes
+NAXIS2  =                    1 / number of rows
+PCOUNT  =                    0 / size of special data area
+GCOUNT  =                    1 / one data group (required keyword)
+TFIELDS =                   21 / number of fields per row
+#
+EXTNAME = HISTORY             / name of this binary table extension
+#
+TTYPE#  = DATE_PRO            / Processing date and time (UTC)
+TFORM#  = 24A                 / 24-char string
+TTYPE#  = PROC_CMD            / Processing program and command
+TFORM#  = 80A                 / 80_char string
+TTYPE#  = SCALE               / Units (FluxDen/RefFlux/Jansky)
+TFORM#  = 8A                  / 8-char string
+TTYPE#  = POL_TYPE            / Polarisation identifier
+TFORM#  = 8A                  / 8-char string
+TTYPE#  = NPOL                / Number of polarisations
+TFORM#  = 1I                  / Integer
+TTYPE#  = NBIN                / Nr of bins per product (0 for SEARCH mode)
+TFORM#  = 1I                  / Integer
+TTYPE#  = NBIN_PRD            / Nr of bins per period
+TFORM#  = 1I                  / Integer
+TTYPE#  = TBIN                / Time per bin or sample
+TUNIT#  = s                   / units of field
+TFORM#  = 1D                  / Double
+TTYPE#  = CTR_FREQ            / Band centre frequency
+TUNIT#  = MHz                 / units of field
+TFORM#  = 1D                  / Double
+TTYPE#  = NCHAN               / Number of frequency channels
+TFORM#  = 1I                  / Integer
+TTYPE#  = CHAN_BW             / Channel bandwidth
+TFORM#  = 1D                  / Double
+TUNIT#  = MHz                 / units of field
+TTYPE#  = PAR_CORR            / Parallactic angle correction applied
+TFORM#  = 1I                  / Integer flag 
+TTYPE#  = FA_CORR             / Feed angle correction applied
+TFORM#  = 1I                  / Integer flag 
+TTYPE#  = RM_CORR             / RM correction applied
+TFORM#  = 1I                  / Integer flag 
+TTYPE#  = DEDISP              / Data dedispersed
+TFORM#  = 1I                  / Integer flag 
+TTYPE#  = DDS_MTHD            / Dedispersion method
+TFORM#  = 32A                 / 32-char string
+TTYPE#  = SC_MTHD             / Scattered power correction method
+TFORM#  = 32A                 / 32-char string
+TTYPE#  = CAL_MTHD            / Calibration method
+TFORM#  = 32A                 / 32-char string
+TTYPE#  = CAL_FILE            / Name of gain calibration file
+TFORM#  = 32A                 / 32-char string
+TTYPE#  = RFI_MTHD            / RFI excision method
+TFORM#  = 32A                 / 32-char string
+TTYPE#  = IFR_MTHD            / Ionospheric Faraday rotation correction method
+TFORM#  = 32A                 / 32-char string
+END
+#
+###############################################################################
+#
+# Digitiser Statistics Binary Table Extension
+#
+###############################################################################
+#
+XTENSION= BINTABLE             / ***** Digitiser statistics *****
+BITPIX  =                    8 / N/A
+NAXIS   =                    2 / 2-dimensional binary table
+NAXIS1  =                    * / Width of table in bytes
+NAXIS2  =                    * / Number of rows in table (NSUBINT)
+PCOUNT  =                    0 / Size of special data area
+GCOUNT  =                    1 / One data group (required keyword)
+TFIELDS =                    1 / Number of fields per row
+#
+DIG_MODE= '                '   / Digitiser mode
+NDIGR   = *                    / Number of digitised channels (I)
+NPAR    = *                    / Number of digitiser parameters
+NCYCSUB = *                    / Number of correlator cycles per subint
+DIGLEV  = '                '   / Digitiser level-setting mode (AUTO, FIX)
+EXTNAME = DIG_STAT             / Name of this binary table extension
+#
+TTYPE#  = ATTEN                / Attenuator settings
+TFORM#  = E                    / NDIGR floats
+TUNIT#  = db                   / Units of field
+TTYPE#  = DATA                 / Digitiser statistics
+TDIM#   = (*,*,*)              / Data table dimensions (NLEV,NDIGR,NCYCSUB)
+TFORM#  = E                    / NPAR*NDIGR*NCYCSUB floats
+END
+#
+###############################################################################
+#
+# Digitiser Counts Binary Table Extension
+#
+###############################################################################
+#
+XTENSION= BINTABLE             / ***** Digitiser counts *****
+BITPIX  =                    8 / N/A
+NAXIS   =                    2 / 2-dimensional binary table
+NAXIS1  =                    * / Width of table in bytes
+NAXIS2  =                    1 / Number of rows in table
+PCOUNT  =                    0 / Size of special data area
+GCOUNT  =                    1 / One data group (required keyword)
+TFIELDS =                    3 / Number of fields per row
+#
+DIG_MODE= '                '   / Digitiser mode
+DYN_LEVT= *                    / Timescale for dynamic leveling
+NDIGR   = *                    / Number of digitised channels (I)
+NLEV    = *                    / Number of digitiser levels
+NPTHIST = *                    / Number of points in histogram (I)
+DIGLEV  = '                '   / Digitiser level-setting mode (AUTO, FIX)
+EXTNAME = DIG_CNTS             / Name of this binary table extension
+#
+TTYPE#  = DAT_OFFS             / Data offset for each histogram
+TFORM#  = E                    / NDIGR floats
+TTYPE#  = DAT_SCL              / Data scale factor for each histogram
+TFORM#  = E                    / NDIGR floats
+TTYPE#  = DATA                 / Digitiser count data
+TDIM#   = (*,*)                / Data table dimensions (NPTHIST,NDIGR)         
+TFORM#  = I                    / NPTHIST*NDIGR integers
+END
+#
+###############################################################################
+#
+# Original Bandpass Binary Table Extension
+#
+###############################################################################
+#
+XTENSION= BINTABLE             / ***** Original bandpasses *****
+BITPIX  =                    8 / N/A
+NAXIS   =                    2 / 2-dimensional binary table
+NAXIS1  =                    * / width of table in bytes
+NAXIS2  =                    1 / number of rows in table
+PCOUNT  =                    0 / size of special data area
+GCOUNT  =                    1 / one data group (required keyword)
+TFIELDS =                    3 / number of fields per row
+#
+NCH_ORIG= *                    / Number of channels in original bandpass
+BP_NPOL = *                    / Number of polarizations in bandpass
+EXTNAME = BANDPASS             / name of this binary table extension
+#
+TTYPE#  = DAT_OFFS             / Data offset for each bandpass
+TFORM#  = E                    / BP_NPOL floats
+TTYPE#  = DAT_SCL              / Data scale factor for each bandpass
+TFORM#  = E                    / BP_NPOL floats
+TTYPE#  = DATA                 / Bandpass for autocorrelations
+TDIM#   = (*,*)                / Data table dimensions = (NCH_ORIG,BP_NPOL)
+TUNIT#  = Jy                   / Bandpass amplitude units
+TFORM#  = I                    / NCH_ORIG*BP_NPOL integers
+END
+#
+###############################################################################
+#
+# Coherent Dedispersion Parameters Binary Table Extension
+#
+###############################################################################
+#
+XTENSION= BINTABLE             / ***** Coherent Dedispersion Parameters *****
+BITPIX  =                    8 / N/A
+NAXIS   =                    2 / 2-dimensional binary table
+NAXIS1  =                    * / width of table in bytes
+NAXIS2  =                    1 / number of rows in table (NCHAN)
+PCOUNT  =                    0 / size of special data area
+GCOUNT  =                    1 / one data group (required keyword)
+TFIELDS =                    3 / number of fields per row
+#
+NFFT    =                    * / Size of forward FFT 
+EXTNAME = COHDDISP             / name of this binary table extension
+#
+TTYPE#  = NOVERLAP             / Number of overlap points for each sub-band
+TFORM#  = 1I                   / Integer
+TTYPE#  = NCHIRP               / Number of points in chirp function
+TFORM#  = 1I                   / Integer
+TTYPE#  = ACBANDPASS           / Bandpass for autocorrelations
+TUNIT#  = Jy                   / Bandpass amplitude units
+TFORM#  = E                    / NCHIRP floats
+END
+#
+###############################################################################
+#
+# Ephemeris History Binary Table Extension
+#
+###############################################################################
+#
+# Note: This table has entries which should be sufficient for real-time folding 
+# of pulsar data. Additional parameters can be added to the table in off-line 
+# processing if necessary. Examples are: additional pulse frequency derivatives 
+# (Fn), additional DM derivatives (DMn), additional planets (T0_n, PB_n, A1_n, 
+# OM_n, ECC_n), additional glitches (GLEP_n, GLPH_n, GLF0_n, GLF1_n, GLF0D_n)
+# and additional FITWAVE coefficients (WAVES_n, WAVEC_n).
+#
+XTENSION= BINTABLE             / ***** Pulsar ephemeris history *****
+BITPIX  =                    8 / N/A
+NAXIS   =                    2 / 2-dimensional binary table
+NAXIS1  =                    * / width of table in bytes
+NAXIS2  =                    * / number of rows in table
+PCOUNT  =                    0 / size of special data area
+GCOUNT  =                    1 / one data group (required keyword)
+TFIELDS =                  104 / number of fields per row
+#
+EXTNAME = PSREPHEM             / name of this binary table extension
+#
+TTYPE#  = DATE_PRO             / Processing date and time (UTC)
+TFORM#  = 24A                  / 24-char string
+TTYPE#  = PROC_CMD             / Processing program and command
+TFORM#  = 80A                  / 80-char string
+TTYPE#  = EPHVER               / Version ID for ephemeris data
+TFORM#  = 16A                  / 16-char string
+TTYPE#  = PSR_NAME             / Pulsar Jname
+TFORM#  = 16A                  / 16-char string
+TTYPE#  = RAJ                  / RA (J2000) (hh:mm:ss.ssssssss)
+TFORM#  = 24A                  / 24-char string
+TTYPE#  = DECJ                 / Dec (J2000) (hh:mm:ss.ssssssss)
+TFORM#  = 24A                  / 24-char string
+TTYPE#  = PMRA                 / Proper motion in RA
+TFORM#  = 1D                   / Double
+TUNIT#  = mas/yr               / Units of field
+TTYPE#  = PMDEC                / Proper motion in DEC
+TFORM#  = 1D                   / Double
+TUNIT#  = mas/yr               / Units of field
+TTYPE#  = ELONG                / [deg] Ecliptic longitude
+TFORM#  = 1D                   / Double
+TUNIT#  = deg                  / Units of field
+TTYPE#  = ELAT                 / Ecliptic latitude
+TFORM#  = 1D                   / Double
+TUNIT#  = deg                  / Units of field
+TTYPE#  = PMELONG              / Proper motion in ecliptic longitude 
+TFORM#  = 1D                   / Double
+TUNIT#  = mas/yr               / Units of field
+TTYPE#  = PMELAT               / Proper motion in ecliptic latitude 
+TFORM#  = 1D                   / Double
+TUNIT#  = mas/yr               / Units of field
+TTYPE#  = PX                   / Parallax
+TFORM#  = 1D                   / Double
+TUNIT#  = mas                  / Units of field
+TTYPE#  = POSEPOCH             / Epoch at which the position is measured (MJD)
+TFORM#  = 1D                   / Double
+TUNIT#  = MJD                  / Units of field
+TTYPE#  = IF0                  / Integer mHz barycentric spin freq
+TFORM#  = 1J                   / Long integer
+TUNIT#  = mHz                  / Units of field
+TTYPE#  = FF0                  / Fractional mHz barycentric spin freq
+TFORM#  = 1D                   / Double
+TUNIT#  = mHz                  / Units of field
+TTYPE#  = F1                   / Time deriv of barycentric spin freq
+TFORM#  = 1D                   / Double
+TUNIT#  = s**(-2)              / Units of field
+TTYPE#  = F2                   / 2nd time deriv of barycentric spin freq
+TFORM#  = 1D                   / Double
+TUNIT#  = s**(-3)              / Units of field
+TTYPE#  = F3                   / 3rd time deriv of barycentric spin freq
+TFORM#  = 1D                   / Double
+TUNIT#  = s**(-4)              / Units of field
+TTYPE#  = PEPOCH               / Epoch of period/frequency determination
+TFORM#  = 1D                   / Double
+TUNIT#  = MJD                  / Units of field
+TTYPE#  = DM                   / Dispersion measure
+TFORM#  = 1D                   / Double
+TUNIT#  = cm**(-3) pc          / Units of field
+TTYPE#  = DM1                  / Time deriv of dispersion measure
+TFORM#  = 1D                   / Double
+TUNIT#  = cm**(-3) pc/yr       / Units of field
+TTYPE#  = RM                   / Rotation measure
+TFORM#  = 1D                   / Double
+TUNIT#  = rad m**(-2)          / Units of field
+TTYPE#  = BINARY               / Binary model
+TFORM#  = 8A                   / 8-char string
+TTYPE#  = T0                   / Epoch of periastron 
+TFORM#  = 1D                   / Double
+TUNIT#  = MJD                  / Units of field
+TTYPE#  = PB                   / Binary period of pulsar 
+TFORM#  = 1D                   / Double
+TUNIT#  = d                    / Units of field
+TTYPE#  = A1                   / Projected semi-major axis of orbit
+TFORM#  = 1D                   / Double
+TUNIT#  = s                    / Units of field
+TTYPE#  = OM                   / Longitude of periastron
+TFORM#  = 1D                   / Double
+TUNIT#  = deg                  / Units of field
+TTYPE#  = OMDOT                / [deg/yr]Periastron advance 
+TFORM#  = 1D                   / Double
+TUNIT#  = deg/yr               / Units of field
+TTYPE#  = ECC                  / Eccentricity
+TFORM#  = 1D                   / Double
+TTYPE#  = PBDOT                / First time deriv of binary period
+TFORM#  = 1D                   / Double
+TTYPE#  = GAMMA                / Post-Keplerian "gamma" term
+TFORM#  = 1D                   / Double
+TUNIT#  = s                    / Units of field
+TTYPE#  = SINI                 / Sine of inclination angle
+TFORM#  = 1D                   / Double
+TTYPE#  = M2                   / Companion mass 
+TFORM#  = 1D                   / Double
+TUNIT#  = Msun                 / Units of field
+TTYPE#  = T0_2                 / Epoch of periastron [2nd orbit] 
+TFORM#  = 1D                   / Double
+TUNIT#  = MJD                  / Units of field
+TTYPE#  = PB_2                 / Binary period of pulsar [2nd orbit]
+TFORM#  = 1D                   / Double
+TUNIT#  = d                    / Units of field
+TTYPE#  = A1_2                 / asin(i) of 2nd orbit
+TFORM#  = 1D                   / Double
+TUNIT#  = s                    / Units of field
+TTYPE#  = OM_2                 / [deg] Longitude of periastron [2nd orbit]
+TFORM#  = 1D                   / Double
+TUNIT#  = deg                  / Units of field
+TTYPE#  = ECC_2                / Eccentricity [2nd orbit]
+TFORM#  = 1D                   / Double
+TTYPE#  = DTHETA               / Relativistic deformation of the orbit
+TFORM#  = 1D                   / Double
+TTYPE#  = A1DOT                / Rate of change of asin(i) 
+TFORM#  = 1D                   / Double
+TTYPE#  = ECCDOT               / Rate of change of eccentricity 
+TFORM#  = 1D                   / Double
+TUNIT#  = s**(-1)              / Units of field
+TTYPE#  = TASC                 / Epoch of ascending node
+TFORM#  = 1D                   / Double
+TUNIT#  = MJD                  / Units of field
+TTYPE#  = EPS1                 / ECC sin(OM) (ELL1 binary model)
+TFORM#  = 1D                   / Double
+TTYPE#  = EPS2                 / ECC cos(OM) (ELL1 binary model)
+TFORM#  = 1D                   / Double
+TTYPE#  = EPS1DOT              / Time derivative of EPS1
+TFORM#  = 1D                   / Double
+TUNIT#  = s**(-1)              / Units of field
+TTYPE#  = EPS2DOT              / Time derivative of EPS2
+TFORM#  = 1D                   / Double
+TUNIT#  = s**(-1)              / Units of field
+TTYPE#  = OM2DOT               / Second time derivative of omega 
+TFORM#  = 1D                   / Double
+TUNIT#  = rad s**(-2)          / Units of field
+TTYPE#  = XOMDOT               / Omega-dot minus GR prediction 
+TFORM#  = 1D                   / Double
+TUNIT#  = deg/yr               / Units of field
+TTYPE#  = XPBDOT               / Pbdot minus GR prediction 
+TFORM#  = 1D                   / Double
+TTYPE#  = MTOT                 / [M_sun] Total system mass 
+TFORM#  = 1D                   / Double
+TUNIT#  = Msun                 / Units of field
+TTYPE#  = DR                   / Relativistic deformation of the orbit
+TFORM#  = 1D                   / Double
+TTYPE#  = X2DOT                / Second time derivative of x=a1 
+TFORM#  = 1D                   / Double
+TUNIT#  = s**(-1)              / Units of field
+TTYPE#  = PMRV                 / Radial proper motion 
+TFORM#  = 1D                   / Double
+TUNIT#  = mas/yr               / Units of field
+TTYPE#  = START                / Epoch of start of fit
+TFORM#  = 1D                   / Double
+TUNIT#  = MJD                  / Units of field
+TTYPE#  = FINISH               / Epoch of end of fit
+TFORM#  = 1D                   / Double
+TUNIT#  = MJD                  / Units of field
+TTYPE#  = TRES                 / RMS timing residual
+TFORM#  = 1D                   / Double
+TUNIT#  = mus                  / Units of field
+TTYPE#  = NTOA                 / Number of TOAs in timing fit
+TFORM#  = 1I                   / Integer
+TNULL#  = 1                    / Null value used by fits_write_col_null
+TTYPE#  = CLK                  / Terrestrial time standard
+TFORM#  = 12A                  / 12-char string
+TTYPE#  = EPHEM                / Solar system ephemeris
+TFORM#  = 12A                  / 12-char string
+TTYPE#  = TZRIMJD              / Reference TOA (Integer part)
+TFORM#  = 1J                   / Long Integer
+TUNIT#  = MJD                  / Units of field
+TTYPE#  = TZRFMJD              / Reference TOA (Fractional part)
+TFORM#  = 1D                   / Double
+TUNIT#  = d                    / Units of field
+TTYPE#  = TZRFRQ               / Frequency of reference TOA
+TFORM#  = 1D                   / Double
+TUNIT#  = MHz                  / Units of field
+TTYPE#  = TZRSITE              / Observatory code of reference TOA
+TFORM#  = 8A                   / 8-char string
+TTYPE#  = GLEP_1               / Epoch [Tempo Glitch 1]
+TFORM#  = 1D                   / Double
+TUNIT#  = MJD                  / Units of field
+TTYPE#  = GLPH_1               / Phase increment [Tempo Glitch 1]
+TFORM#  = 1D                   / Double
+TTYPE#  = GLF0_1               / Permanent pulse freq increment [Glitch 1]
+TFORM#  = 1D                   / Double
+TUNIT#  = Hz                   / Units of field
+TTYPE#  = GLF1_1               / Permanent freq deriv incr. [Glitch 1] 
+TFORM#  = 1D                   / Double
+TUNIT#  = s**(-2)              / Units of field
+TTYPE#  = GLF0D_1              / Spin freq increment [Decaying Glitch 1]
+TFORM#  = 1D                   / Double
+TUNIT#  = Hz                   / Units of field
+#
+# New parameters for TEMPO2, ignored for EPHVER < 5
+#
+TTYPE#  = ECLOBL               / Ecliptic obliquity 
+TFORM#  = 1D                   / Double
+TUNIT#  = arcsec               / Units of field
+TTYPE#  = IPM                  / Correct for interplanetary dispersion 
+TFORM#  = 1I                   / Integer flag
+TNULL#  = 1                    / Default = True
+TTYPE#  = TEMPO1               / Tempo1 emulation mode 
+TFORM#  = 1I                   / Integer flag
+TNULL#  = 0                    / Default = False
+TTYPE#  = DILATEFREQ           / Correct obs frequency for time dilation 
+TFORM#  = 1I                   / Integer flag
+TNULL#  = 1                    / Default = True
+TTYPE#  = NO_SS_SHAPIRO        / Turn of all solar system Shapiro delays
+TFORM#  = 1I                   / Integer flag
+TNULL#  = 0                    / Default = False
+TTYPE#  = PLANET_SHAPIRO       / Account for planetary Shapiro delays 
+TFORM#  = 1I                   / Integer flag
+TNULL#  = 1                    / Default = True
+TTYPE#  = CORRECT_TROPO        / Correct for tropospheric delays 
+TFORM#  = 1I                   / Integer flag
+TNULL#  = 1                    / Default = True
+TTYPE#  = UNITS                / Units for SSB timescale (SI, TDB) 
+TFORM#  = 4A                   / String
+TNULL#  = SI                   / Default = SI
+TTYPE#  = NE1AU                / Solar electron density scale @1AU
+TFORM#  = 1D                   / Double
+TUNIT#  = cm**(-3) pc          / Units of field
+TTYPE#  = TIMEEPH              / Time ephemeris code to use (IF99, fb90)
+TFORM#  = 6A                   / String
+TNULL#  = IF99                 / Default = IF99
+TTYPE#  = T2CMETHOD            / Polar Motion/Prec/Nut code (IAU2000B, TEMPO)
+TFORM#  = 9A                   / String
+TNULL#  = IAU2000B             / Default = IAU2000B
+TTYPE#  = DMFACTOR             / DM/Dispersion Constant 
+TFORM#  = 1D                   / Double
+TUNIT#  = cm**(-3) pc s**(-3)  / Units of field
+TTYPE#  = DMEPOCH              / Epoch for DM 
+TFORM#  = 1D                   / Double
+TUNIT#  = MJD                  / Units of field
+TTYPE#  = FDDC                 / Scale of freq-dependent delay 
+TFORM#  = 1D                   / Double
+TUNIT#  = s MHz**(-FDDI)       / Units of field
+TTYPE#  = FDDI                 / Spectral index of freq-dependent delay
+TFORM#  = 1D                   / Double
+TTYPE#  = MSS                  / Use Wex 1988 "MSS" in T2 binary model 
+TFORM#  = 1I                   / Integer flag
+TNULL#  = 0                    / Default = False
+TTYPE#  = BINIT                / Iterate to invert binary timing formula
+TFORM#  = 1I                   / Integer flag
+TNULL#  = 1                    / Default = True
+TTYPE#  = SHAPMAX              / -ln(1-sini) Shapiro delay parameter
+TFORM#  = 1D                   / Double
+TTYPE#  = KOM                  / Position angle of ascending node 
+TFORM#  = 1D                   / Double
+TUNIT#  = deg                  / Units of field
+TTYPE#  = KIN                  / Inclination of orbit, for Kopeikin terms
+TFORM#  = 1D                   / Double
+TUNIT#  = deg                  / Units of field
+TTYPE#  = KMPRA                / PMRA for Kopeikin term 
+TFORM#  = 1D                   / Double
+TUNIT#  = mas/yr               / Units of field
+TTYPE#  = KPMDEC               / PMDEC for Kopeikin term 
+TFORM#  = 1D                   / Double
+TUNIT#  = mas/yr               / Units of field
+TTYPE#  = KPMELONG             / PMELONG for Kopeikin term
+TFORM#  = 1D                   / Double
+TUNIT#  = mas/yr               / Units of field
+TTYPE#  = KPMELAT              / PMELAT for Kopeikin term 
+TFORM#  = 1D                   / Double
+TUNIT#  = mas/yr               / Units of field
+TTYPE#  = RV                   / Radial velocity 
+TFORM#  = 1D                   / Double
+TUNIT#  = km/s                 / Units of field
+TTYPE#  = RVS                  / Radial velocity for Shklovskii-dot term
+TFORM#  = 1D                   / Double
+TUNIT#  = km/s                 / Units of field
+TTYPE#  = VT                   / Transverse velocity for Doppler term
+TFORM#  = 1D                   / Double
+TUNIT#  = m s**(-2)            / Units of field
+TTYPE#  = RACC                 / Radial acceleration 
+TFORM#  = 1D                   / Double
+TUNIT#  = m s**(-2)            / Units of field
+TTYPE#  = PMACC                / Accel parallel to proper motion 
+TFORM#  = 1D                   / Double
+TUNIT#  = m s**(-2)            / Units of field
+TTYPE#  = D_SHK                / Distance for Shklovskii term 
+TFORM#  = 1D                   / Double
+TUNIT#  = kpc                  / Units of field
+TTYPE#  = D_AOP                / Distance for annual-orbital parallax 
+TFORM#  = 1D                   / Double
+TUNIT#  = kpc                  / Units of field
+TTYPE#  = D_OP                 / Distance for orbital parallax 
+TFORM#  = 1D                   / Double
+TUNIT#  = kpc                  / Units of field
+TTYPE#  = WAVE_FREQ            / Fundamental FITWAVE frequency
+TFORM#  = 1D                   / Double
+TUNIT#  = Hz                   / Units of field
+TTYPE#  = WAVES_1              / FITWAVE sine component amplitude
+TFORM#  = 1D                   / Double
+TUNIT#  = s                    / Units of field
+TTYPE#  = WAVEC_1              / FITWAVE cosine component amplitude
+TFORM#  = 1D                   / Double
+TUNIT#  = s                    / Units of field
+END
+#
+###############################################################################
+#
+# TEMPO1 Polyco History Binary Table Extension
+#
+###############################################################################
+#
+XTENSION= BINTABLE             / ***** Polyco history *****
+BITPIX  =                    8 / N/A 
+NAXIS   =                    2 / 2-dimensional binary table
+NAXIS1  =                    * / width of table in bytes
+NAXIS2  =                    * / number of rows in table
+PCOUNT  =                    0 / size of special data area
+GCOUNT  =                    1 / one data group (required keyword)
+TFIELDS =                   13 / Number of fields per row
+#
+EXTNAME = POLYCO               / name of this binary table extension
+#
+TTYPE#  = DATE_PRO             / Processing date and time (UTC)
+TFORM#  = 24A                  / 24-char string
+TTYPE#  = POLYVER              / Polyco version ID
+TFORM#  = 16A                  / 16-char string
+TTYPE#  = NSPAN                / Span of polyco in min
+TFORM#  = 1I                   / Integer
+TTYPE#  = NCOEF                / Nr of coefficients (<=15)
+TFORM#  = 1I                   / Integer
+TTYPE#  = NPBLK                / Nr of blocks (rows) for this polyco
+TFORM#  = 1I                   / Integer
+TTYPE#  = NSITE                / Observatory code
+TFORM#  = 8A                   / 8-char string
+TTYPE#  = REF_FREQ             / Reference frequency for phase
+TFORM#  = 1D                   / Double
+TUNIT#  = MHz                  / Units of field
+TTYPE#  = PRED_PHS             / Predicted pulse phase at obs start
+TFORM#  = 1D                   / Double
+TTYPE#  = REF_MJD              / Reference MJD
+TFORM#  = 1D                   / Double
+TTYPE#  = REF_PHS              / Reference phase
+TFORM#  = 1D                   / Double
+TTYPE#  = REF_F0               / Zero-order pulsar frequency
+TUNIT#  = Hz                   / Units of field
+TFORM#  = 1D                   / Double
+TTYPE#  = LGFITERR             / Log_10 of polynomial fit rms error in periods
+TFORM#  = 1D                   / Double
+TTYPE#  = COEFF                / Polyco coefficients
+TFORM#  = 15D                  / NCOEF doubles
+END
+#
+###############################################################################
+#
+# TEMPO2 Predictor History Binary Table Extension
+#
+###############################################################################
+#
+XTENSION= BINTABLE             / ***** Tempo2 Predictor history *****
+BITPIX  =                    8 / N/A 
+NAXIS   =                    2 / 2-dimensional binary table
+NAXIS1  =                    * / width of table in bytes
+NAXIS2  =                    * / number of rows in table
+PCOUNT  =                    0 / size of special data area
+GCOUNT  =                    1 / one data group (required keyword)
+TFIELDS =                    1 / Number of fields per row
+#
+EXTNAME = T2PREDICT            / name of this binary table extension
+#
+TTYPE#  = PREDICT              / Whole text file is stored verbatim
+TFORM#  = A 
+END
+#
+###############################################################################
+#
+# Flux Calibration Data Binary Table Extension
+#
+###############################################################################
+#
+XTENSION= BINTABLE             / ***** Flux Calibration Data *****
+BITPIX  =                    8 / N/A 
+NAXIS   =                    2 / 2-dimensional binary table
+NAXIS1  =                    * / width of table in bytes
+NAXIS2  =                    1 / number of rows in table
+PCOUNT  =                    0 / size of special data area
+GCOUNT  =                    1 / one data group (required keyword)
+TFIELDS =                    6 / Number of fields per row
+#
+EXTNAME = FLUX_CAL             / name of this binary table extension
+CAL_MTHD=                      / Flux cal method
+SCALFILE=                      / Cal file(s) used to derive flux-cal data
+NCHAN   =                    * / Nr of frequency channels (I)
+NRCVR   =                    * / Number of receiver channels (I)
+EPOCH   =                      / [MJD] Epoch of calibration obs
+#
+TTYPE#  = DAT_FREQ             / Centre frequency for each channel
+TFORM#  = E                    / NCHAN floats
+TUNIT#  = MHz                  / Units of field
+TTYPE#  = DAT_WTS              / Weights for each channel
+TFORM#  = E                    / NCHAN floats
+TTYPE#  = S_SYS                / System equiv. flux density for each rcvr chan.
+TDIM#   = (*,*)                / Dimensions (NCHAN,NRCVR)
+TFORM#  = E                    / NCHAN*NRCVR floats
+TUNIT#  = Jy        
+TTYPE#  = S_SYSERR             / Est. error of system equiv. flux density
+TDIM#   = (*,*)                / Dimensions (NCHAN,NRCVR)
+TFORM#  = E                    / NCHAN*NRCVR floats
+TUNIT#  = Jy        
+TTYPE#  = S_CAL                / Calibrator flux density for each rcvr channel
+TDIM#   = (*,*)                / Dimensions (NCHAN,NRCVR)
+TFORM#  = E                    / NCHAN*NRCVR floats
+TUNIT#  = Jy        
+TTYPE#  = S_CALERR             / Estimated error of calibrator flux density
+TDIM#   = (*,*)                / Dimensions (NCHAN,NRCVR)
+TFORM#  = E                    / NCHAN*NRCVR floats
+TUNIT#  = Jy      
+END
+#
+###############################################################################
+#
+# Artificial Calibrator Stokes Parameters Binary Table Extension
+#
+###############################################################################
+#
+XTENSION= BINTABLE             / ***** Artificial Calibrator Stokes Data *****
+BITPIX  =                    8 / N/A 
+NAXIS   =                    2 / 2-dimensional binary table
+NAXIS1  =                    * / width of table in bytes
+NAXIS2  =                    1 / number of rows in table
+PCOUNT  =                    0 / size of special data area
+GCOUNT  =                    1 / one data group (required keyword)
+TFIELDS =                    3 / Number of fields per row
+#
+EXTNAME = CAL_POLN             / name of this binary table extension
+NCHAN   =                    * / Nr of channels in flux cal file
+#
+TTYPE#  = DAT_WTS              / Weights for each channel
+TFORM#  = E                    / NCHAN floats
+TTYPE#  = DATA                 / Stokes (Q,U,V) of calibrator rel. to Cal I
+TFORM#  = E                    / 3*NCHAN floats
+TTYPE#  = DATAERR              / Estimated error of Stokes (Q,U,V)
+TFORM#  = E                    / 3*NCHAN floats
+END
+#
+###############################################################################
+#
+# Feed Cross-Coupling Parameters Binary Table Extension
+#
+###############################################################################
+#
+XTENSION= BINTABLE             / ***** Feed Cross-Coupling parameters *****
+BITPIX  =                    8 / N/A 
+NAXIS   =                    2 / 2-dimensional binary table
+NAXIS1  =                    * / width of table in bytes
+NAXIS2  =                    1 / number of rows in table
+PCOUNT  =                    0 / size of special data area
+GCOUNT  =                    1 / one data group (required keyword)
+TFIELDS =                    3 / Number of fields per row
+#
+EXTNAME = FEEDPAR              / Name of this binary table extension
+CAL_MTHD= '                  ' / Cross-coupling method
+NCPAR   =                    * / Number of coupling parameters
+NCHAN   =                    * / Nr of channels in Feed coupling data
+EPOCH   = '                  ' / [MJD] Epoch of calibration obs
+#
+TTYPE#  = DAT_FREQ             / [MHz] Centre frequency for each channel
+TFORM#  = E                    / NCHAN floats
+TUNIT#  = MHz                  / Units of field
+TTYPE#  = DAT_WTS              / Weights for each channel
+TFORM#  = E                    / NCHAN floats
+TTYPE#  = DATA                 / Cross-coupling data
+TDIM#   = (*,*)                / Dimensions (NCHAN,NCPAR)
+TFORM#  = E                    / NCHAN*NCPAR floats
+TTYPE#  = DATAERR              / Estimated error of cross-coupling data
+TDIM#   = (*,*)                / Dimensions (NCHAN,NCPAR)
+TFORM#  = E                    / NCHAN*NCPAR floats
+END
+#
+###############################################################################
+#
+# Subintegration data Binary Table Extension
+#
+###############################################################################
+#
+XTENSION= BINTABLE             / ***** Subintegration data  *****
+BITPIX  =                    8 / N/A
+NAXIS   =                    2 / 2-dimensional binary table
+NAXIS1  =                    * / width of table in bytes 
+NAXIS2  =                    * / Number of rows in table (NSUBINT)
+PCOUNT  =                    0 / size of special data area
+GCOUNT  =                    1 / one data group (required keyword)
+TFIELDS =                   19 / Number of fields per row
+# 
+INT_TYPE= '                  ' / Time axis (TIME, BINPHSPERI, BINLNGASC, etc)
+INT_UNIT= '                  ' / Unit of time axis (SEC, PHS (0-1), DEG)    
+NCH_FILE=                    * / Number of channels/sub-bands in this file
+NCH_STRT=                    * / Start channel/sub-band number (0 to NCHAN-1)
+EXTNAME = SUBINT               / name of this binary table extension
+#
+TTYPE#  = ISUBINT              / Subint number
+TFORM#  = 1J                   / Long integer
+TTYPE#  = INDEXVAL             / Optionally used if INT_TYPE != TIME
+TFORM#  = 1D                   / Double
+TTYPE#  = TSUBINT              / Length of subintegration
+TFORM#  = 1D                   / Double 
+TUNIT#  = s                    / Units of field
+TTYPE#  = OFFS_SUB             / Offset from Start of subint centre
+TFORM#  = 1D                   / Double 
+TUNIT#  = s                    / Units of field
+TTYPE#  = LST_SUB              / LST at subint centre 
+TFORM#  = 1D                   / Double 
+TUNIT#  = s                    / Units of field
+TTYPE#  = RA_SUB               / RA (J2000) at subint centre
+TFORM#  = 1D                   / Double 
+TUNIT#  = turns                / Units of field
+TTYPE#  = DEC_SUB              / [turns] Dec (J2000) at subint centre
+TFORM#  = 1D                   / Double 
+TUNIT#  = turns                / Units of field
+TTYPE#  = GLON_SUB             / [deg] Gal longitude at subint centre
+TFORM#  = 1D                   / Double 
+TUNIT#  = deg                  / Units of field
+TTYPE#  = GLAT_SUB             / [deg] Gal latitude at subint centre
+TFORM#  = 1D                   / Double 
+TUNIT#  = deg                  / Units of field
+TTYPE#  = FD_ANG               / [deg] Feed angle at subint centre
+TFORM#  = 1E                   / Float
+TUNIT#  = deg                  / Units of field
+TTYPE#  = POS_ANG              / [deg] Position angle of feed at subint centre
+TFORM#  = 1E                   / Float
+TUNIT#  = deg                  / Units of field
+TTYPE#  = PAR_ANG              / [deg] Parallactic angle at subint centre
+TFORM#  = 1E                   / Float
+TUNIT#  = deg                  / Units of field
+TTYPE#  = TEL_AZ               / [deg] Telescope azimuth at subint centre
+TFORM#  = 1E                   / Float 
+TUNIT#  = deg                  / Units of field
+TTYPE#  = TEL_ZEN              / [deg] Telescope zenith angle at subint centre
+TFORM#  = 1E                   / Float
+TUNIT#  = deg                  / Units of field
+TTYPE#  = DAT_FREQ             / [MHz] Centre frequency for each channel
+TFORM#  = E                    / NCH_FILE floats
+TUNIT#  = deg                  / Units of field
+TTYPE#  = DAT_WTS              / Weights for each channel
+TFORM#  = E                    / NCH_FILE floats
+TTYPE#  = DAT_OFFS             / Data offset for each channel
+TFORM#  = E                    / NCH_FILE*NPOL floats
+TTYPE#  = DAT_SCL              / Data scale factor for each channel
+TFORM#  = E                    / NCH_FILE*NPOL floats
+TTYPE#  = DATA                 / Subint data table
+TDIM#   = (*,*,*)              / Dimensions of data table = (NBIN,NCH_FILE,NPOL)
+TFORM#  = I                    / NBIN*NCH_FILE*NPOL integers
+TUNIT#  = Jy                   / Units of subint data
+END
+
+
+
+
+
+
+
+\end
Index: /trunk/data/templates/psrheaderSimple.txt
===================================================================
--- /trunk/data/templates/psrheaderSimple.txt	(revision 1)
+++ /trunk/data/templates/psrheaderSimple.txt	(revision 1)
@@ -0,0 +1,127 @@
+SIMPLE  =                    T / file does conform to FITS standard
+BITPIX  =                    8 / number of bits per data pixel
+NAXIS   =                    0 / number of data axes
+EXTEND  =                    T / FITS dataset may contain extensions
+COMMENT   FITS (Flexible Image Transport System) format defined in Astronomy and
+COMMENT   Astrophysics Supplement Series v44/p363, v44/p371, v73/p359, v73/p365.
+COMMENT   Contact the NASA Science Office of Standards and Technology for the
+COMMENT   FITS Definition document #100 and other FITS information.
+COMMENT
+HDRVER  = '2.4             '   / Header version 
+DATE    = '                '   / File creation date (YYYY-MM-DDThh:mm:ss UTC)
+OBSERVER= '                '   / Observer name(s)
+PROJID  = '                '   / Project name
+TELESCOP= '                '   / Telescope name
+ANT_X   = *                    / [m] Antenna ITRF X-coordinate (D)
+ANT_Y   = *                    / [m] Antenna ITRF Y-coordinate (D)
+ANT_Z   = *                    / [m] Antenna ITRF Z-coordinate (D)
+FRONTEND= '                '   / Rx and feed ID
+FD_POLN = '                '   / LIN or CIRC
+FD_HAND = *                    / +/- 1. +1 is LIN:A=X,B=Y, CIRC:A=L,B=R (I)
+FD_SANG = *                    / [deg] FA of E vect for equal sig in A&B (E)
+FD_XYPH = *                    / [deg] Phase of A^* B for injected cal (E)
+BACKEND = '                '   / Backend ID
+BECONFIG= '                '   / Backend configuration file name
+BE_PHASE= *                    / 0/+1/-1 BE cross-phase:0 unknown,+/-1 std/rev
+BE_DCC  = *                    / 0/1 BE downconversion conjugation corrected
+TCYCLE  = *                    / [s] On-line cycle time (D)
+NRCVR   = *                    / Number of receiver channels (I)
+OBS_MODE= '                '   / (PSR, CAL, SEARCH)
+SRC_NAME= '                '   / Source or scan ID 
+COORD_MD= '                '   / Coordinate mode (J2000, Gal, Ecliptic, etc.)
+STT_CRD1= '                '   / Start coord 1 (hh:mm:ss.sss or ddd.ddd)
+STT_CRD2= '                '   / Start coord 2 (-dd:mm:ss.sss or -dd.ddd) 
+TRK_MODE= '                '   / Track mode (TRACK, SCANGC, SCANLAT)
+STP_CRD1= '                '   / Stop coord 1 (hh:mm:ss.sss or ddd.ddd)
+STP_CRD2= '                '   / Stop coord 2 (-dd:mm:ss.sss or -dd.ddd) 
+SCANLEN = *                    / [s] Requested scan length (E)
+FD_MODE = '                '   / Feed track mode - FA, CPA, SPA, TPA
+FA_REQ  = *                    / [deg] Feed/Posn angle requested (E)
+CAL_MODE= '                '   / Cal mode (OFF, SYNC, EXT1, EXT2)
+CAL_FREQ= *                    / [Hz] Cal modulation frequency (E)
+CAL_DCYC= *                    / Cal duty cycle (E)
+CAL_PHS = *                    / Cal phase (wrt start time) (E)
+STT_DATE= '                '   / Start UT date (YYYY-MM-DD)
+STT_TIME= '                '   / Start UT (hh:mm:ss)
+STT_IMJD= *                    / Start MJD (UTC days) (J - long integer)
+STT_SMJD= *                    / [s] Start time (sec past UTC 00h) (J)
+STT_OFFS= *                    / [s] Start time offset (D)   
+STT_LST = *                    / [s] Start LST (D)
+END
+#
+###############################################################################
+#
+# Subintegration data Binary Table Extension
+#
+###############################################################################
+#
+XTENSION= BINTABLE             / ***** Subintegration data  *****
+BITPIX  =                    8 / N/A
+NAXIS   =                    2 / 2-dimensional binary table
+NAXIS1  =                    * / width of table in bytes 
+NAXIS2  =                    * / Number of rows in table (NSUBINT)
+PCOUNT  =                    0 / size of special data area
+GCOUNT  =                    1 / one data group (required keyword)
+TFIELDS =                   19 / Number of fields per row
+# 
+INT_TYPE= '                  ' / Time axis (TIME, BINPHSPERI, BINLNGASC, etc)
+INT_UNIT= '                  ' / Unit of time axis (SEC, PHS (0-1), DEG)    
+NCH_FILE=                    * / Number of channels/sub-bands in this file
+NCH_STRT=                    * / Start channel/sub-band number (0 to NCHAN-1)
+EXTNAME = SUBINT               / name of this binary table extension
+#
+TTYPE#  = ISUBINT              / Subint number
+TFORM#  = 1J                   / Long integer
+TTYPE#  = INDEXVAL             / Optionally used if INT_TYPE != TIME
+TFORM#  = 1D                   / Double
+TTYPE#  = TSUBINT              / Length of subintegration
+TFORM#  = 1D                   / Double 
+TUNIT#  = s                    / Units of field
+TTYPE#  = OFFS_SUB             / Offset from Start of subint centre
+TFORM#  = 1D                   / Double 
+TUNIT#  = s                    / Units of field
+TTYPE#  = LST_SUB              / LST at subint centre 
+TFORM#  = 1D                   / Double 
+TUNIT#  = s                    / Units of field
+TTYPE#  = RA_SUB               / RA (J2000) at subint centre
+TFORM#  = 1D                   / Double 
+TUNIT#  = turns                / Units of field
+TTYPE#  = DEC_SUB              / [turns] Dec (J2000) at subint centre
+TFORM#  = 1D                   / Double 
+TUNIT#  = turns                / Units of field
+TTYPE#  = GLON_SUB             / [deg] Gal longitude at subint centre
+TFORM#  = 1D                   / Double 
+TUNIT#  = deg                  / Units of field
+TTYPE#  = GLAT_SUB             / [deg] Gal latitude at subint centre
+TFORM#  = 1D                   / Double 
+TUNIT#  = deg                  / Units of field
+TTYPE#  = FD_ANG               / [deg] Feed angle at subint centre
+TFORM#  = 1E                   / Float
+TUNIT#  = deg                  / Units of field
+TTYPE#  = POS_ANG              / [deg] Position angle of feed at subint centre
+TFORM#  = 1E                   / Float
+TUNIT#  = deg                  / Units of field
+TTYPE#  = PAR_ANG              / [deg] Parallactic angle at subint centre
+TFORM#  = 1E                   / Float
+TUNIT#  = deg                  / Units of field
+TTYPE#  = TEL_AZ               / [deg] Telescope azimuth at subint centre
+TFORM#  = 1E                   / Float 
+TUNIT#  = deg                  / Units of field
+TTYPE#  = TEL_ZEN              / [deg] Telescope zenith angle at subint centre
+TFORM#  = 1E                   / Float
+TUNIT#  = deg                  / Units of field
+TTYPE#  = DAT_FREQ             / [MHz] Centre frequency for each channel
+TFORM#  = E                    / NCH_FILE floats
+TUNIT#  = deg                  / Units of field
+TTYPE#  = DAT_WTS              / Weights for each channel
+TFORM#  = E                    / NCH_FILE floats
+TTYPE#  = DAT_OFFS             / Data offset for each channel
+TFORM#  = E                    / NCH_FILE*NPOL floats
+TTYPE#  = DAT_SCL              / Data scale factor for each channel
+TFORM#  = E                    / NCH_FILE*NPOL floats
+TTYPE#  = DATA                 / Subint data table
+TDIM#   = (*,*,*)              / Dimensions of data table = (NBIN,NCH_FILE,NPOL)
+TFORM#  = I                    / NBIN*NCH_FILE*NPOL integers
+TUNIT#  = Jy                   / Units of subint data
+END
+
Index: /trunk/data/templates/simpletabletemplate.fits
===================================================================
--- /trunk/data/templates/simpletabletemplate.fits	(revision 1)
+++ /trunk/data/templates/simpletabletemplate.fits	(revision 1)
@@ -0,0 +1,9 @@
+  xtension = bintable
+  naxis2 = 40
+  ttype# = Name
+  tform# = 10a
+  ttype# = Npoints
+  tform# = j
+  ttype# = Rate
+  tunit# = counts/s
+  tform# = e
Index: /trunk/data/templates/simpletemplate.fits
===================================================================
--- /trunk/data/templates/simpletemplate.fits	(revision 1)
+++ /trunk/data/templates/simpletemplate.fits	(revision 1)
@@ -0,0 +1,6 @@
+SIMPLE  = T
+BITPIX  = 32
+NAXIS   = 2     / number of dimensions
+NAXIS1  = 100  / length of first axis
+NAXIS2  = 200  / length of second axis
+OBJECT  = NGC 253 / name of observed object
Index: unk/do_all_s70v.csh
===================================================================
--- /trunk/do_all_s70v.csh	(revision 486)
+++ 	(revision )
@@ -1,55 +1,0 @@
-#!/bin/tcsh
-
-if( $# == 0 ) then
-    echo "Usage: do_all_s70v.csh logfile"
-    echo "  Give the *full* path for the logfile."
-else
-    set cwd=`pwd`
-    cd $S70V
-    touch $1
-    @ i = 1
-    set date=`date`
-    echo "" >> $1
-    echo "================================================" >> $1
-    echo "Conversion of $S70TAPES, started $date" >> $1
-    echo "================================================" >> $1
-    while( $i <= 500 )
-	set dir=`echo $i | awk '{printf "S%03d", $1}'`
-	echo "" >> $1
-	echo "Tape directory: $dir" >> $1
-	echo "--------------------" >> $1
-	if( -e $S70TAPES/$dir ) then
-	    foreach f ( `/bin/ls -d $S70TAPES/$dir/*` )
-		echo "" >> $1
-		echo "File = $f" >> $1
-		pvoconvert -V $f >>& $1
-	    end
-	else
-	    echo " Directory does not exist" >> $1
-	endif
-	@ i++
-    end
-
-    cd $S70V/S70V
-    @ i = 501
-    while( $i <= 613 )
-	set dir=`echo $i | awk '{printf "S%03d", $1}'`
-	echo "" >> $1
-	echo "Tape directory: $dir" >> $1
-	echo "--------------------" >> $1
-	if( -e $S70TAPES/$dir ) then
-	    foreach f ( `/bin/ls -d $S70TAPES/$dir/*` )
-		echo "" >> $1
-		echo "File = $f" >> $1
-		pvoconvert -V $f >>& $1
-	    end
-        else
-	    echo " Directory does not exist" >> $1
-	endif
-	@ i++
-    end
-
-    cd $cwd
-
-endif
-
Index: unk/docs/VOimplementation.tex
===================================================================
--- /trunk/docs/VOimplementation.tex	(revision 486)
+++ 	(revision )
@@ -1,670 +1,0 @@
-\documentclass{article}
-\usepackage{natbib}
-%\usepackage{fancyheadings}
-\usepackage{fancyhdr}
-\usepackage{array}
-\usepackage{xspace}
-\usepackage{hyperref}
-\hypersetup{colorlinks=true}
-
-\textwidth=165 mm
-\textheight=248 mm
-\topmargin=-15 mm
-\oddsidemargin=0 mm
-\parindent=6 mm
-
-\pagestyle{fancy}
-\rhead{}
-\lhead{}
-\lfoot{\today}
-\cfoot{}
-\rfoot{\thepage}
-\renewcommand{\headrulewidth}{0cm}
-\renewcommand{\footrulewidth}{0cm}
-
-\newcommand{\eg}{e.g.\xspace}
-\newcommand{\ie}{i.e.\xspace}
-
-\begin{document}
-\begin{flushright}
-{\huge Implementation of VO queries}\\
-\vspace{5mm}{\Large Matthew Whiting}
-\end{flushright}
-
-\tableofcontents
-
-\section{Summary}
-
-This document summarises how the VO-compliant query form is to be set
-up, what queries we expect, and what modifications need to be made
-from where the archive is at present (June 2007). This will be
-continually updated as this part of the project progresses.
-
-\newpage
-\section{Expected queries}
-
-Here is a list of expected queries that the archive should be able to
-deal with, along with comments on each:
-
-\begin{itemize}
-
-\item All observations of a given pulsar.
-\\ \textit{This is essentially how the archive works at the moment.}
-
-\item All observations of a given sky position, within a search radius
-  -- this is essentially a conesearch.  
-\\ \textit{This also exists on the archive at the moment, but doesn't
-    seem to work. An example: a search for J0835-4510 returns a large
-    number of files, but a search at its RA \& Dec gives nothing (\ie
-    ``No pulsars found within (08:35:20.700, -45:10:35.700) with
-    radius 2'').}
-
-\item Accept standard conesearch queries from a VO service.
-\\ \textit{Not possible at present.}
-
-\item All observations within given time range, perhaps combined with
-  above. 
-\\ \textit{A time-range is catered for at present -- and it seems to
-  work fine.}
-
-\item Be able to refine queries based on pulsar parameters.
-\\ \textit{\ie search for all pulsars with period in a given range, or
-  with DM greater than some value... This is not catered for at present.}
-
-\end{itemize}
-
-This is mostly a wish-list. The current project (as at June 2007) will
-involve enabling conesearches to be made on survey data, as well as
-the queries that are currently possible with the on-line
-archive. Conesearches on timing data, particularly with concurrent
-searches on pulsar parameters is probably beyond the scope of what we
-can do.
-
-\newpage
-\section{The mySQL database}
-
-We note here some important points for the mySQL database. It is based
-on \texttt{herschel}, with two accounts: \textbf{pulsar} and
-\textbf{psrdba} -- the latter is the administrative account and should
-be used for adding/modifying tables and so on. The first allows
-searching of tables and other similar queries only.
-
-The full set of php, sql and related files that Albert has compiled
-reside on the machine \texttt{herschel}, in 
-\texttt{herschel:/var/www/vhosts/pulsararchive.atnf.csiro.au/htdocs}
-and sub-directories. This includes the perl script
-\texttt{perl/find\_archives.pl}, which does the trawling of the disks
-to pick up new data files.
-
-\subsection{Problems}
-
-\begin{itemize}
-\item When you are on herschel, you cannot see the \texttt{/psr} disk,
-  which means all the psr programs are unavailable. Is there any
-  reason for this? It is particularly a problem with the
-  position-related query on the web archive, as this uses \texttt{vap}
-  to search for pulsars around a given position.
-\item The version of mySQL could probably do with an update. It is
-  only 4.0, and it would be great to have 5.0 or similar so that we
-  could create functions easily -- I'm thinking functions like an
-  angular separation calculator, as this would make the cone-search
-  queries much easier to write.
-\end{itemize}
-
-\newpage
-\section{Existing data: The ``observations'' table}
-
-The list of the columns in the existing \texttt{observations}
-mySQL table is given in the table in
-Appendix~\ref{app-obstable}. There is a second table,
-\texttt{observations2} that has different data in it -- it is not
-clear exactly what this data is or where it comes from (there is no
-reference to it in any of the files in the \texttt{htdocs} directory
-on \texttt{herschel}. Its setup (which is slightly different to
-\texttt{observations}) is also shown in Appendix~\ref{app-obstable}. 
-
-\subsection{Missing and incomplete data}
-
-There are several columns that have no information -- that is, every
-row in the table is NULL. They are: date, ut, gl, gb, tsamp, nbeam.
-
-\subsection{Positional information}
-
-Note that the sky positions for the files in the \texttt{observations}
-table are broken up into hours/degrees, minutes and seconds
-columns. This presents a problem, as the declination information does
-not properly record positions like -00:01:23. This is because you
-cannot distinguish between $-0$ and $+0$ in the decj\_degree entry.
-
-The positions should either be stored as decimal degrees (best
-option), or, if the hours/degrees, minutes and seconds must be stored
-separately, also have a decj\_sign column that indicates the sign of
-the declination (equal to +1 or $-1$). The positions could also be
-stored as a string (\ie ``18:23:45.3''), although a numerical value
-will also be needed for angular separation calculations.
-
-An example of how we can create new columns to store the decimal
-degree values is the following bit of SQL code:
-\begin{quote}
-\begin{verbatim}
-SELECT pulsar_name,filename,data_type,decj_degree,decj_minute,decj_second,
-        (raj_hour+raj_minute/60.+raj_second/3600.)*15 as raj,
-        CASE WHEN pulsar_name LIKE "%-%" 
-             THEN -1.*(abs(decj_degree)+decj_minute/60.+decj_second/3600.)
-             ELSE abs(decj_degree)+decj_minute/60.+decj_second/3600. 
-             END as decj
-FROM observations 
-WHERE abs(decj_degree)<1 
-      AND (decj_minute>0 or decj_second>0) 
-ORDER BY pulsar_name;
-\end{verbatim}
-\end{quote}
-
-Currently the positions are stored incorrectly even in the ATNF Pulsar
-Database\footnote{See
-http://www.atnf.csiro.au/research/pulsar/psrcat/}. A search ``within
-circular boundary'' with radius of 1 degree from 16:07:00, -00:30:00
-does not return J1607$-$0032, which appears to be 1.05 degrees
-away. This is because the DECJ is returned as +00:32:40.83 (\ie the
-sign of the declination is not preserved). This seems to be a wider
-problem, originating with the \texttt{psrcat} program.
-
-A new table can be created very simply that has two new columns with
-the decimal values of RA and DEC in it. We can also put values:
-\begin{quote}
-  \begin{verbatim}
--- version of mysql is <4.1 so cannot use CREATE ... LIKE ...
-CREATE TEMPORARY TABLE newobs
-  SELECT *,
-      (raj_hour+raj_minute/60.+raj_second/3600.)*15 as raj,
-      CASE WHEN pulsar_name LIKE "%-%" 
-               THEN -1.*(abs(decj_degree)+decj_minute/60.+decj_second/3600.)
-           WHEN (decj_degree<0.)
-               THEN -1.*(abs(decj_degree)+decj_minute/60.+decj_second/3600.)
-           ELSE abs(decj_degree)+decj_minute/60.+decj_second/3600. 
-      END AS decj
-  FROM observations;
-  \end{verbatim}
-\end{quote}
-Note the two clauses that set the declination to be negative. The
-first is designed to deal with sources that have
-$-1^\circ<\delta<0^\circ$, and looks at the name to see if it has a
-minus sign. The second clause deals with sources that don't have an
-``IAU-format'' name (such as ``CAL''). This will only catch them if
-they have $\delta<-1^\circ$, but fortunately all the sources with
-$-1^\circ<\delta<0^\circ$ are suitably named to be caught by the first
-clause. 
-
-The only remaining problem sources as far as positions go are those
-with no positional information in the table. There are 246 rows that
-satisfy this criterion -- how are we going to deal with these? If they
-have a pulsar name, then we can access the positions somehow and
-manually put them in. However that may be a somewhat labourious
-process...
-
-While adding in the decimal RA \& Dec, we could also add in the proper
-values for the galactic coordinates. These have not been put in the
-database for most/all(?) of the existing data, and so we could do it
-all at once. The code is shown in
-\texttt{sql/create\_new\_obs\_table.sql}: it first creates a temp copy
-of \texttt{observations}, with RA and DEC but without GL and GB. It
-then creates a new table with the following code, calculating the
-values of GL and GB:
-\begin{quote}
-\begin{verbatim}
-SET @ngpra=192.859508, @ngpdec=27.128336, @ascnode=32.932; -- base coords for galactic coord transformation.
-
-CREATE TEMPORARY TABLE newobs
-   SELECT *,
-        case when degrees( atan2( ( sin(radians(decjd))*cos(radians(@ngpdec)) - cos(radians(decjd))*sin(radians(@ngpdec))*cos(radians(rajd-@ngpra)) ) , ( cos(radians(decjd))*sin(radians(rajd-@ngpra)) ) ) ) + @ascnode > 0 
-	     then degrees( atan2( ( sin(radians(decjd))*cos(radians(@ngpdec)) - cos(radians(decjd))*sin(radians(@ngpdec))*cos(radians(rajd-@ngpra)) ) , ( cos(radians(decjd))*sin(radians(rajd-@ngpra)) ) ) ) + @ascnode
-	     else degrees( atan2( ( sin(radians(decjd))*cos(radians(@ngpdec)) - cos(radians(decjd))*sin(radians(@ngpdec))*cos(radians(rajd-@ngpra)) ) , ( cos(radians(decjd))*sin(radians(rajd-@ngpra)) ) ) ) + @ascnode + 360. end as gl,
-	(degrees( asin( cos(radians(decjd))*cos(radians(@ngpdec))*cos(radians(rajd-@ngpra)) + sin(radians(decjd))*sin(radians(@ngpdec))))) as gb
-    FROM temptab;
-\end{verbatim}
-\end{quote}
-
-\newpage
-\section{The new data: 70cm Survey}
-
-\subsection{Location of data}
-
-The data is going to be stored in the \$S70V directory, once it is
-converted to PSRFITS format from the PKS format files in
-\$S70TAPES. There is some data there now, most of which is not up to
-date with all the metadata (it was converted earlier in the year, with
-older versions of the \textsc{pvoconvert} code and the PSRFITS
-definition file), and some that I have converted in the past week.
-
-\subsection{Incorporating the data into the database}
-
-It is relatively straightforward to load the data into the database,
-either directly using SQL commands or via the PHP interface. Here's an
-example of how it should be done (taken from
-\texttt{\$PVO/sql/create\_larger\_s70\_table.sql}), using the larger
-table format detailed in Appendix~\ref{app-unifiedtable}:
-\begin{quote}
-\begin{verbatim}
--- create the table with the following fields
-CREATE TEMPORARY TABLE bigS70 (
-	filename VARCHAR(32),
-	data_loc VARCHAR(100),
- 	file_size_bytes INT(32),
-	project_id VARCHAR(10),
-	hdrver VARCHAR(10),
-	survey VARCHAR(10),
-	telescope VARCHAR(16),
- 	site VARCHAR(8),    
-	src_name VARCHAR(16),
- 	date VARCHAR(16),   
- 	ut VARCHAR(16),   
- 	MJD DECIMAL(32,26),
-	raj VARCHAR(20),
-	decj VARCHAR(20),
-	rajd DOUBLE,
-	decjd DOUBLE,
-	gl DOUBLE,
-	gb DOUBLE,
-	bmaj FLOAT,
-	bmin FLOAT,
-	bpa FLOAT,
-	dm DECIMAL(16,10),
-	period DECIMAL(32,24),
-	cnfg VARCHAR(128),
- 	inst VARCHAR(32),
-	data_type VARCHAR(128),
- 	rcvr VARCHAR(16),   
- 	obsrvr VARCHAR(32),   
-        obsfreq DECIMAL(32,16),
-	chanbw DECIMAL(16,6),
- 	nchan INT(6),        
-	npol INT(6),
- 	nbin INT(6),        
- 	nsub INT(6),        
- 	scanlen DECIMAL(32,20),
- 	tsamp FLOAT,       
-	nbits tinyint(3) unsigned,  
-	nbeam tinyint(3) unsigned,
-	PRIMARY KEY (filename, data_loc)
-);
-
-LOAD DATA LOCAL
-INFILE "/pulsar/archive13/S70V/summary_S70.csv"
-INTO TABLE bigS70
-FIELDS TERMINATED BY ","
-OPTIONALLY ENCLOSED BY "\""
-IGNORE 1 LINES  -- this ignores the first line in the csv file which contains the column headers.
-(filename,data_loc,file_size_bytes,project_id,hdrver,survey,telescope,site,src_name,date,ut,MJD,
-raj,decj,rajd,decjd,gl,gb,bmaj,bmin,bpa,dm,period,cnfg,inst,data_type,rcvr,obsrvr,obsfreq,chanbw,
-nchan,npol,nbin,nsub,scanlen,tsamp,nbits,nbeam);
-\end{verbatim}
-\end{quote}
-
-The exact columns are still to be fully determined, but the SQL makeup
-will be as given in Appendix~\ref{app-s70table}.
-
-
-\newpage
-\section{VO conesearch queries}
-
-\subsection{How it can be done in SQL code}
-
-Here is an example of how you can query the database, once the 70cm
-data is in there, by searching for angular separation:
-\begin{quote}
-\begin{verbatim}
--- Performing a conesearch around the position 
---  RA=0.=00:00:00 and DEC=-43.=-43:00:00 for the S70 data.
--- This should pick up three files from the new batch added on June 26.
--- The old query of RA=0 and DEC=-49 should pick up four files.
-SET @qra=0., @qdec=-49.;
-SELECT filename, raj, decj, 0.5*(bmaj+bmin) AS beamsize, obsfreq, scanlen,
-       (degrees( acos( cos(radians(rajd-@qra))*
-                       cos(radians(decjd))*cos(radians(@qdec))
-                      +sin(radians(decjd))*sin(radians(@qdec)) ) )) AS angsep
-FROM s70
-WHERE (degrees( acos( cos(radians(rajd-@qra))*
-                      cos(radians(decjd))*cos(radians(@qdec))
-                     +sin(radians(decjd))*sin(radians(@qdec)) ) ) 
-        - 0.25*(bmaj+bmin) ) <  1.
-ORDER BY angsep;
-\end{verbatim}
-\end{quote}
-
-\subsection{Producing a VOTable}
-
-The above SQL structure can be readily incorporated into a .php file
-and used to query the database via a dynamic webpage. This .php file
-can also produce an XML file rather than the usual HTML format. The
-way to do this is to have the following expression at the start of the
-php file:
-\begin{quote}
-\verb|header("Content-type: text/xml");|
-\end{quote}
-to make sure the resulting file is read as XML. 
-
-From there, it is straightforward to put in the necessary VOTable
-fields and fill in the data that results from the query. This is done
-in the file \texttt{conequery-vo.php}.
-
-\subsection{Provision of data -- what's in the VOTable?}
-
-The VOTable that we provide is simply a table of metadata. By default
-all metadata that is in the SQL table is provided, with the exception
-of the file's disk location. We do provide the filename, but that is
-all -- there is no mechanism to directly obtain the data from the
-cone-search query.
-
-The reasoning here is that a user might first do a VO cone-search, and
-then, if a result of interest came up, they would then go to the web
-archive and repeat the search. The web archive's results page would
-then provide means for downloading the data, in much the same way as
-it is set up at present (thanks to Albert).
-
-\subsection{Registering the VO cone search service}
-
-For the conesearch service to be widely accessible, it should be
-registered with a VO registry. There are a number of such registries,
-which typically have forms that allow registration of new
-services. Two sites that provide links to registries are:
-\begin{enumerate}
-\item NVO at \href{http://www.us-vo.org/pubs/files/PublishHowTo.html}%
-  {http://www.us-vo.org/pubs/files/PublishHowTo.html}, linking to
-  three different NVO registries.
-\item Euro-VO, at
-  \href{http://www.euro-vo.org/pub/tc/registries.html}%
-  {http://www.euro-vo.org/pub/tc/registries.html}, which also links to
-  three different registries.
-\end{enumerate}
-
-It is unclear whether all these registries are linked together, in
-such a way that registering at one provides access through all. This
-is the aim of VO registries, but it is not apparent whether this is
-reality yet. This needs to be sorted out.
-
-The process of registering a service involves providing the registry
-with metadata about the service. The full list of Resource Metadata
-can be found in the IVOA document ``Resource Metadata for the Virtual
-Observatory'', at \href{http://www.ivoa.net/Documents/latest/RM.html}%
-{http://www.ivoa.net/Documents/latest/RM.html}.
-
-\newpage
-\section{The web query form}
-
-\subsection{Structure}
-
-This section will layout the rough format of the query form that acts
-as the front-end to the archive. The following options should exist:
-\begin{itemize}
-\item Position query. RA \& Dec should be the default. May be useful
-  to offer the possibility of a query in Galactic coordinates. Will
-  need to be able to switch between these.
-
-  Also need a search radius box. Default units in arcmin? degrees?
-  Allow this to be selectable?
-
-\item Pulsar name. This should accept a pulsar name, be able to deal
-  with a leading letter (\eg J1234$-$5678 and 1234$-$5678 should act the
-  same). This functionality exists, although check that it uses SQL
-  directly and not vap or similar.
-
-\item Time of observation. This should be a range, default values
-  being the range of observation dates in the database (although maybe
-  make final date today's date?). 
-
-  It may be good to make this field selectable as well, so that one
-  can query with MJD rather than date. 
-
-\item Refinement of returned parameters. Since there are different
-  tables with different fields, the way to deal with this might be to
-  make a master list of fields to select from. The queries can then
-  only refer to the relevant ones for their table and set the others
-  to NULL or similar (can we use something like \textit{left outer
-    join}?).
-
-  Perhaps a format similar to that used by
-  Vizier\footnote{\href{http://vizier.u-strasbg.fr/cgi-bin/VizieR}%
-    {http://vizier.u-strasbg.fr/cgi-bin/VizieR} -- see an example
-    catalogue at
-    \href{http://vizier.u-strasbg.fr/viz-bin/VizieR?-source=VIII/34}%
-    {http://vizier.u-strasbg.fr/viz-bin/VizieR?-source=VIII/34}
-    (select ``catalog'').},
-  where it provides a default list of parameters but allows selection
-  of more and querying on them as well.
-
-  The way it is currently set up does not allow querying on these
-  parameters. This is beyond the scope of the current project,
-  although may be worthwhile implementing in the future. Something
-  similar is enabled with the pulsar database (\ie querying on
-  \textit{pulsar} parameters such as period, DM, period-derivative),
-  although there is no data access involved. The difference here is
-  that one would be able to query on the parameters related to the
-  observations (such as \texttt{tsamp, nchan}).
-
-\item We should be able to query on Project ID. This will facilitate
-  obtaining recent observations from a particular project. This should
-  also use the authentication scheme detailed below to determine
-  whether the user has access rights for the data.
-
-\item There should be a selectable option to choose whether timing or
-  survey data is desired, or whether all data should be returned. This
-  has many things in common with the following point, so we need to
-  think about how best to combine them. The options could be a
-  selectable list including ``timing'', ``70cm survey'', ``multibeam
-  survey'', ...
-
-\item The existing webpage has the possibility of restricting the
-  query by specifying what type of data to look for (CPSR2, DFB,
-  WBC). This should be extended to include FB\_1BIT (as for the 70cm
-  data) and MFB (for multibeam-filterbank -- uncertain exactly what to
-  call this at this stage). These need to be included in the database
-  ingest, and be extracted from the database in making the query page.
-
-  The selection of data type could allow more than one selection --
-  this will change how the selection is done in the sql query.
-
-\end{itemize}
-
-\subsection{Authentication}
-
-Currently, the authentication of users is done via a \texttt{users}
-table in the mySQL database. A better way would be to do something
-similar to that used by ATOA\footnote{Australia Telescope Online
-  Archive, \href{http://atoa.atnf.csiro.au}%
-  {http://atoa.atnf.csiro.au}.}
-This accesses the OPAL database to authenticate users, and also allows
-proprietary access to data. This is achieved by associating a Project
-ID with each file, and having a list of accredited observers
-associated with each Project ID. If the user is in the list of
-observers for the ID listed with the file in question, the user is
-allowed to access the file. Otherwise, the file is marked as
-unavailable. 
-
-The way the OPAL database is accessed can be hidden from the main
-archive web page, and be wrapped up in a single php function
-call. This part should be straightforward.
-
-The determination of proprietary access will require a bit of work, as
-the Project ID is currently \textbf{not} stored in the mySQL
-database. This will need to be incorporated and stored as part of the
-upkeep of the database.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\newpage
-\appendix
-\section{The ``observations'' table setup}
-\label{app-obstable}
-
-\begin{table}[h]
-\begin{tabular}{l|l|l|l|l|l}
- Field             & Type                & Null & Key & Default      & Extra \\
-\hline
- pulsar\_name      & varchar(16)         &      &     &              &\\
- filename          & varchar(32)         &      & PRI &              &\\
- raj\_hour         & int(2)              & YES  &     & 0            &\\
- raj\_minute       & int(2)              & YES  &     & 0            &\\
- raj\_second       & decimal(12,10)      & YES  &     & 0.0000000000 &\\
- decj\_degree      & int(2)              & YES  &     & 0            &\\
- decj\_minute      & int(2)              & YES  &     & 0            &\\
- decj\_second      & decimal(12,10)      & YES  &     & 0.0000000000 &\\
- dm                & decimal(16,10)      & YES  &     & NULL         &\\
- period            & decimal(32,24)      & YES  &     & NULL         &\\
- bw                & decimal(16,6)       & YES  &     & NULL         &\\
- cnfg              & varchar(128)        & YES  &     & NULL         &\\
- data\_loc         & varchar(128)        &      & PRI &              &\\
- data\_type        & varchar(16)         & YES  &     & NULL         &\\
- freq              & decimal(32,16)      & YES  &     & NULL         &\\
- inst              & varchar(32)         & YES  &     & NULL         &\\
- MJD               & decimal(32,26)      & YES  &     & NULL         &\\
- npol              & int(6)              & YES  &     & NULL         &\\
- nchan             & int(6)              & YES  &     & NULL         &\\
- nbin              & int(6)              & YES  &     & NULL         &\\
- nsub              & int(6)              & YES  &     & NULL         &\\
- rcvr              & varchar(16)         & YES  &     & NULL         &\\
- site              & varchar(8)          & YES  &     & NULL         &\\
- file\_size\_bytes & int(32)             & YES  &     & NULL         &\\
- length            & decimal(32,20)      & YES  &     & NULL         &\\
- obsrvr            & varchar(32)         & YES  &     & NULL         &\\
- date              & varchar(16)         & YES  &     & NULL         &\\
- ut                & varchar(16)         & YES  &     & NULL         &\\
- gl                & float               & YES  &     & NULL         &\\
- gb                & float               & YES  &     & NULL         &\\
- tsamp             & float               & YES  &     & NULL         &\\
- nbeam             & tinyint(3) unsigned & YES  &     & NULL         &\\
-\end{tabular}
-\caption{Fields for the \texttt{observations} table in the mySQL
-  database, as it stands at present.}
-\label{tab-obs}
-\end{table}
-
-\newpage
-
-\begin{table}[h]
-\begin{tabular}{l|l|l|l|l|l}
- Field               & Type           & Null & Key & Default      & Extra \\
-\hline
- pulsar\_name        & varchar(16)    &      &     &              &\\
- filename            & varchar(32)    &      &     &              &\\
- raj\_hour           & int(2)         & YES  &     & 0            &\\
- raj\_minute         & int(2)         & YES  &     & 0            &\\
- raj\_second         & decimal(12,10) & YES  &     & 0.0000000000 &\\
- decj\_degree        & int(2)         & YES  &     & 0            &\\
- decj\_minute        & int(2)         & YES  &     & 0            &\\
- decj\_second        & decimal(12,10) & YES  &     & 0.0000000000 &\\
- dm                  & decimal(16,10) & YES  &     & NULL         &\\
- period              & decimal(32,24) & YES  &     & NULL         &\\
- bw                  & decimal(16,6)  & YES  &     & NULL         &\\
- cal\_file\_loc      & varchar(128)   & YES  &     & NULL         &\\
- cnfg                & varchar(128)   & YES  &     & NULL         &\\
- data\_loc           & varchar(128)   &      &     &              &\\
- data\_type          & varchar(16)    & YES  &     & NULL         &\\
- freq                & decimal(32,16) & YES  &     & NULL         &\\
- inst                & varchar(32)    & YES  &     & NULL         &\\
- MJD                 & decimal(32,26) & YES  &     & NULL         &\\
- npol                & int(6)         & YES  &     & NULL         &\\
- nchan               & int(6)         & YES  &     & NULL         &\\
- nbin                & int(6)         & YES  &     & NULL         &\\
- nsub                & int(6)         & YES  &     & NULL         &\\
- processing\_options & varchar(255)   & YES  &     & NULL         &\\
- is\_calibrated      & tinyint(1)     & YES  &     & 0            &\\
- rcvr                & varchar(16)    & YES  &     & NULL         &\\
- site                & varchar(8)     & YES  &     & NULL         &\\
- file\_size\_bytes   & int(32)        & YES  &     & NULL         &\\
- length              & decimal(32,20) & YES  &     & NULL         &\\
- obsrvr              & varchar(32)    & YES  &     & NULL         &\\
-\end{tabular}
-\caption{Fields for the \texttt{observations2} table in the mySQL
-  database.}
-\label{tab-obs2}
-\end{table}
-
-\newpage
-\section{Proposed ``S70'' table setup}
-\label{app-s70table}
-
-\begin{table}[h]
-\begin{tabular}{l|l|l|l|l|l}
- Field      & Type                 & Null & Key & Default & Extra\\
-\hline      
- file\_id   & smallint(5) unsigned &      & PRI & NULL    & auto\_increment\\
- filename   & varchar(30)          & YES  &     & NULL    &\\
- fileloc    & varchar(100)         & YES  &     & NULL    &\\
- hdrver     & varchar(10)          & YES  &     & NULL    &\\
- survey     & varchar(10)          & YES  &     & NULL    &\\
- src\_name  & varchar(20)          & YES  &     & NULL    &\\
- telescope  & varchar(16)          & YES  &     & NULL    &\\
- data\_type & varchar(16)          & YES  &     & NULL    &\\
- raj        & varchar(15)          & YES  &     & NULL    &\\
- decj       & varchar(15)          & YES  &     & NULL    &\\
- rajd       & double               & YES  &     & NULL    &\\
- decjd      & double               & YES  &     & NULL    &\\
- gl         & decimal(9,4)         & YES  &     & NULL    &\\
- gb         & decimal(9,4)         & YES  &     & NULL    &\\
- bmaj       & float                & YES  &     & NULL    &\\
- bmin       & float                & YES  &     & NULL    &\\
- bpa        & float                & YES  &     & NULL    &\\
- date\_obs  & varchar(30)          & YES  &     & NULL    &\\
- mjd        & double               & YES  &     & NULL    &\\
- obsfreq    & double               & YES  &     & NULL    &\\
- chanbw     & double               & YES  &     & NULL    &\\
- nchan      & int                  & YES  &     & NULL    &\\
- scanlen    & double               & YES  &     & NULL    &\\
- tsamp      & double               & YES  &     & NULL    &\\
- nbits      & int                  & YES  &     & NULL    &\\
-\end{tabular}
-\caption{Fields for the proposed 70cm data table in the mySQL
-  database.}
-\label{tab-s70}
-\end{table}
-
-\newpage
-\section{Proposed Unified table setup}
-\label{app-unifiedtable}
-
-\begin{table}[h]
-\begin{tabular}{l|l|l|l|l|p{5cm}}
- Field      & Type                 & Null & Key & Default & Comments\\
-\hline      
- filename   & varchar(30)          & YES  & PRI & NULL    & All tables.\\
- src\_name  & varchar(20)          & YES  &     & NULL    & Rename pulsar\_name to src\_name\\
- project\_id & varchar(10)         & YES  &     & NULL    &\\
- raj        & varchar(15)          & YES  &     & NULL    & Text format 12:34:56.78\\
- decj       & varchar(15)          & YES  &     & NULL    &\\
- data\_type & varchar(16)          & YES  &     & NULL    &\\
- obsfreq    & double               & YES  &     & NULL    &\\
- bw         & double               & YES  &     & NULL    &\\
- scanlen    & double               & YES  &     & NULL    & Rename \texttt{observations} field length\\
- date       & varchar(16)          & YES  &     & NULL    &\\
- ut         & varchar(16)          & YES  &     & NULL    &\\
- mjd        & double               & YES  &     & NULL    &\\
- rajd       & double               & YES  &     & NULL    & Decimal degrees: 188.7365833\\
- decjd     & double               & YES  &     & NULL    &\\
- gl         & decimal(9,4)         & YES  &     & NULL    & Decimal degrees\\
- gb         & decimal(9,4)         & YES  &     & NULL    &\\
- bmaj       & float                & YES  &     & NULL    &\\
- bmin       & float                & YES  &     & NULL    &\\
- bpa        & float                & YES  &     & NULL    &\\
- dm         & decimal(16,10)       & YES  &     & NULL    & Will be NULL for survey data.\\
- period     & decimal(32,24)       & YES  &     & NULL    & Will be NULL for survey data.\\
- nchan      & int (6)              & YES  &     & NULL    &\\
- npol       & int(6)               & YES  &     & NULL    &\\
- nbin       & int(6)               & YES  &     & NULL    &\\
- nsub       & int(6)               & YES  &     & NULL    &number of subintegrations\\
- tsamp      & double               & YES  &     & NULL    &\\
- nbits      & tinyint(3) unsigned  & YES  &     & NULL    &\\
- nbeam      & tinyint(3) unsigned  & YES  &     & NULL    &\\
- cnfg       & varchar(128)         & YES  &     & NULL    & Will be NULL for 70cm data\\
- inst       & varchar(32)          & YES  &     & NULL    & For 70cm, set same as data\_type\\
- rcvr       & varchar(16)          & YES  &     & NULL    &\\
- hdrver     & varchar(10)          & YES  &     & NULL    &\\
- survey     & varchar(10)          & YES  &     & NULL    &\\
- telescope  & varchar(16)          & YES  &     & NULL    &\\
- site       & varchar(8)           & YES  &     & NULL    &\\
- obsrvr     & varchar(32)          & YES  &     & NULL    &\\
- data\_loc  & varchar(100)         & YES  & PRI & NULL    &\\
- file\_size\_bytes & int(32)       & YES  &     & NULL    &\\
-\end{tabular}
-\caption{Fields for a table in the mySQL database that unifies the content of the existing tables and the desired content for the PKS70 table.}
-\label{tab-s70}
-\end{table}
-\end{document}
Index: unk/docs/VOrequirements.tex
===================================================================
--- /trunk/docs/VOrequirements.tex	(revision 486)
+++ 	(revision )
@@ -1,385 +1,0 @@
-\documentclass{article}
-\usepackage{natbib}
-\usepackage{fancyheadings}
-\usepackage{array}
-\usepackage{xspace}
-
-\textwidth=165 mm
-\textheight=248 mm
-\topmargin=-15 mm
-\oddsidemargin=0 mm
-\parindent=6 mm
-
-\pagestyle{fancy}
-\rhead{}
-\lhead{}
-\lfoot{\today}
-\cfoot{}
-\rfoot{\thepage}
-\setlength{\headrulewidth}{0in}
-
-\newcommand{\eg}{e.g.\xspace}
-\newcommand{\ie}{i.e.\xspace}
-
-\begin{document}
-%\titlepage
-\begin{flushright}
-{\huge Requirements for the VO queries}\\
-\vspace{5mm}{\Large Matthew Whiting}
-\end{flushright}
-
-\section{Summary}
-
-This document summarises what we want the new VO-compliant query form
-to do, what queries we expect, and how it is going to be
-implemented. This will be continually updated as this part of the
-project progresses.
-
-The scope of this project is just to look at the survey data and
-provide a way of accessing it through the web archive. It will not
-directly cover the existing timing observations, although there
-obviously should be some commonality in the way the data is accessed. 
-
-\section{Expected queries}
-
-Here is a list of expected queries that the archive should be able to
-deal with, along with comments on each:
-
-\begin{itemize}
-
-\item All observations of a given pulsar.
-\\ \textit{This is essentially how the archive works at the moment.}
-
-\item All observations of a given sky position, within a search radius
-  -- this is essentially a conesearch.  
-\\ \textit{This also exists on the archive at the moment, but doesn't
-    seem to work. An example: a search for J0835-4510 returns a large
-    number of files, but a search at its RA \& Dec gives nothing (\ie
-    ``No pulsars found within (08:35:20.700, -45:10:35.700) with
-    radius 2'').}
-
-\item Accept standard conesearch queries from a VO service.
-\\ \textit{Not possible at present.}
-
-\item All observations within given time range, perhaps combined with
-  above. 
-\\ \textit{A time-range is catered for at present -- and it seems to
-  work fine.}
-
-\item Be able to refine queries based on pulsar parameters.
-\\ \textit{\ie search for all pulsars with period in a given range, or
-  with DM greater than some value... This is not catered for at present.}
-
-\end{itemize}
-
-This is mostly a wish-list. The current project (as at June 2007) will
-involve enabling conesearches to be made on survey data, as well as
-the queries that are currently possible with the on-line
-archive. Conesearches on timing data, particularly with concurrent
-searches on pulsar parameters is probably beyond the scope of what we
-can do.
-
-\newpage
-\section{Work needed}
-
-\subsection{Positional queries}
-
-For the new (survey) data, we need some way of calculating whether a
-given position lies in the field of view (\ie within the primary beam)
-of the observation. Or, alternatively, whether a cone being searched
-covers at least part of the beam of a FITS file.
-
-This should be straightforward to calculate, as each of the new FITS
-files contains a position and beam size information. It should thus be
-possible to work out whether the two regions (beam of observation and
-cone being searched) intersect.
-
-It might also be possible to do this with the existing data -- that
-is, the pointed (timing) observations of known pulsars. The
-information, again, should be there (we know the telescope and
-observation frequency, and so should be able to calculate the beam
-size). This will require a bit more effort (as much with the effort of
-reading information from different data formats), and so should depend
-on whether this is considered useful -- would there be an interest in
-searching for pulsars in the fields of known ones at different DM
-values for instance?
-
-The question is how to actually implement this? The current setup for
-the archive query (given in the file
-\texttt{/var/www/vhosts/pulsararchive.atnf.csiro.au/htdocs/query.php}) 
-is to use mysql commands to access the database. In this manner it
-finds entries in the database that match the query. The list of
-pulsars that match is given by the command \textsc{psrcat}, so if we
-are going to have this work in the same way we need a similar function
-for the survey data. 
-
-The conesearch option should be able to accept a standard-format
-conesearch from a VO service. The details of the implementation of
-such a query are left up to the archive itself, so we have complete
-freedom as to how the querying is done. The results need to be able to
-be presented in a standard (VOTable) fashion -- as well as via the web
-page presumably.
-
-Note that we will require the database to hold all the survey data!
-See the next section for a discussion of this.
-
-\subsection{Database}
-
-The MySQL database will need to hold the information for the survey
-data. This will need to be in a different table to the current
-``observations'' table, as there is no particular pulsar in each file,
-but rather the positions are the key information. 
-
-Once all the data is converted to useful (FITS) format, a table can
-then be populated with the required information. I would suggest
-having essentially the same info as in the observations table, making
-sure though that the beam-size is present. 
-
-\textbf{Question: } Would it be possible to add a beam-size column to
-the observations table? See point above about positional queries.
-
-As for the existing data, note that there are a number of columns that
-are not defined for any file: date, ut, gl, gb, tsamp, nbeam. These
-may need to be defined before this is made public.
-
-The existing archive has a trawling script%
-\footnote{\texttt{herschel:/var/www/vhosts/pulsararchive.atnf.csiro.au/htdocs/perl/find\_archives.pl}}
-that searches for new files and incorporates them into the SQL
-archive. Such a script will not be necessary for the survey data, as
-there is a fixed amount of data for each survey, so, provided the data
-has all been converted, such a search will only need to be done once
-(and not periodically through a cron job).
-
-\subsection{Output considerations}
-
-Currently, one gets a webpage with a list of files matching the
-criteria, from which one selects files to download.
-
-For the archive to act as a web service, it will need to be a bit more
-flexible, providing the results in a format such as a VOTable. This
-could include as one of the columns a URL for the data. Currently, the
-data is tarred \sout{and compressed} before one downloads it, and it is not
-clear how that can be done with a URL in a VOTable. Or, indeed,
-whether it needs to be done -- will it be OK to just provide the links
-to the data?
-
-\newpage
-\section{Details of implementation}
-
-\subsection{Conesearch}
-
-We want to implement a simple conesearch query that will search the
-survey data. Here is a list of things that need to be present:
-\begin{enumerate}
-\item\label{list-filestore} The PSRFITS files need to be in some
-  central location.
-\item\label{list-metadata} The metadata from these files needs to be
-  stored \eg in an SQL database for easy access and
-  searching. Essential metadata includes: filename, file location, RA,
-  Dec, beam size, time and date, observation frequency, survey, ...
-\item\label{list-queryinput} A web page or web service to accept a
-  query. The conesearch could be entered as an option from the
-  existing archive webpage.
-\item\label{list-querySQL} A way of using the information from the
-  query in a search of the database \ie a simple way of taking the
-  entered RA, Dec, radius and performing the conesearch on the RA,
-  DEC, Beam size columns in the database.
-\item\label{list-queryout} A way of converting the results of the SQL
-  query into a useful format for either displaying in the web browser
-  or returning via the web service.
-\end{enumerate}
-
-The details of \#\ref{list-filestore} are, to a certain extent, fixed,
-with all the data going on the new large disks (once the final details
-of the file conversion have been verified).
-
-Obtaining the metadata should be a straightforward process. I have
-written a program \texttt{pvosummary} that prints many of these basic
-metadata fields, and this could easily be developed for use in a
-script that trawls the data directory. This is essentially what is
-done with the current archive, where \texttt{vap} is used to print the
-details of the timing observations, which are then incorporated into
-the mySQL database.
-
-The program \texttt{pvosummary} is able to produce a
-comma-separated-values (csv) file that can subsequently be read into
-the SQL database. Alternatively, a C/C++ program could be developed to
-read the data directly into the database via the mySQL C-API. 
-
-The metadata listed at \#\ref{list-metadata} above is simply the
-essential data that would be required to service the query. Other data
-is probably going to be required: the full list of columns from the
-observations table in the mySQL database for the timing observations
-is given in Table~\ref{tab-obs}. The proposed list of columns for the
-S70 data is given in Table~\ref{tab-s70} -- this can be filled out as
-needs dictate.
-
-\begin{table}
-\begin{tabular}{l|l|l|l|l|l}
- Field             & Type                & Null & Key & Default      & Extra \\
-\hline
- pulsar\_name      & varchar(16)         &      &     &              &\\
- filename          & varchar(32)         &      & PRI &              &\\
- raj\_hour         & int(2)              & YES  &     & 0            &\\
- raj\_minute       & int(2)              & YES  &     & 0            &\\
- raj\_second       & decimal(12,10)      & YES  &     & 0.0000000000 &\\
- decj\_degree      & int(2)              & YES  &     & 0            &\\
- decj\_minute      & int(2)              & YES  &     & 0            &\\
- decj\_second      & decimal(12,10)      & YES  &     & 0.0000000000 &\\
- dm                & decimal(16,10)      & YES  &     & NULL         &\\
- period            & decimal(32,24)      & YES  &     & NULL         &\\
- bw                & decimal(16,6)       & YES  &     & NULL         &\\
- cnfg              & varchar(128)        & YES  &     & NULL         &\\
- data\_loc         & varchar(128)        &      & PRI &              &\\
- data\_type        & varchar(16)         & YES  &     & NULL         &\\
- freq              & decimal(32,16)      & YES  &     & NULL         &\\
- inst              & varchar(32)         & YES  &     & NULL         &\\
- MJD               & decimal(32,26)      & YES  &     & NULL         &\\
- npol              & int(6)              & YES  &     & NULL         &\\
- nchan             & int(6)              & YES  &     & NULL         &\\
- nbin              & int(6)              & YES  &     & NULL         &\\
- nsub              & int(6)              & YES  &     & NULL         &\\
- rcvr              & varchar(16)         & YES  &     & NULL         &\\
- site              & varchar(8)          & YES  &     & NULL         &\\
- file\_size\_bytes & int(32)             & YES  &     & NULL         &\\
- length            & decimal(32,20)      & YES  &     & NULL         &\\
- obsrvr            & varchar(32)         & YES  &     & NULL         &\\
- date              & varchar(16)         & YES  &     & NULL         &\\
- ut                & varchar(16)         & YES  &     & NULL         &\\
- gl                & float               & YES  &     & NULL         &\\
- gb                & float               & YES  &     & NULL         &\\
- tsamp             & float               & YES  &     & NULL         &\\
- nbeam             & tinyint(3) unsigned & YES  &     & NULL         &\\
-\end{tabular}
-\caption{Fields for the \textbf{observations} table in the mySQL
-  database, as it stands at present.}
-\label{tab-obs}
-\end{table}
-
-\begin{table}
-\begin{tabular}{l|l|l|l|l|l}
- Field     & Type                 & Null & Key & Default & Extra\\
-\hline
- file\_id  & smallint(5) unsigned &      & PRI & NULL    & auto\_increment\\
- filename  & varchar(30)          & YES  &     & NULL    &\\
- fileloc   & varchar(100)         & YES  &     & NULL    &\\
- hdrver    & varchar(10)          & YES  &     & NULL    &\\
- survey    & varchar(10)          & YES  &     & NULL    &\\
- src\_name & varchar(20)          & YES  &     & NULL    &\\
- raj       & varchar(15)          & YES  &     & NULL    &\\
- decj      & varchar(15)          & YES  &     & NULL    &\\
- rajd      & double               & YES  &     & NULL    &\\
- decjd     & double               & YES  &     & NULL    &\\
- bmaj      & float                & YES  &     & NULL    &\\
- bmin      & float                & YES  &     & NULL    &\\
- bpa       & float                & YES  &     & NULL    &\\
- date\_obs & varchar(30)          & YES  &     & NULL    &\\
- mjd       & double               & YES  &     & NULL    &\\
- obsfreq   & double               & YES  &     & NULL    &\\
- chanbw    & double               & YES  &     & NULL    &\\
- nchan     & int                  & YES  &     & NULL    &\\
- scanlen   & double               & YES  &     & NULL    &\\
- tbin      & double               & YES  &     & NULL    &\\
-\end{tabular}
-\caption{Fields for the proposed \textbf{70} table in the mySQL
-  database.}
-\label{tab-s70}
-\end{table}
-
-
-\subsection{Storing positional information}
-
-A brief note on how the positions are stored currently and how they
-should be stored. 
-
-The way the declination information (\eg decj\_degree, decj\_minute,
-decj\_second) is stored is no good, as it will not properly record
-positions like -00:01:23. This is because you cannot distinguish
-between $-0$ and $+0$ in the decj\_degree entry.
-
-The positions should either be stored as decimal degrees (best
-option), or, if the hours/degrees, minutes and seconds must be stored
-separately, also have a decj\_sign column that indicates the sign of
-the declination (equal to +1 or $-1$). The positions could also be
-stored as a string (\ie ``18:23:45.3''), although a numerical value
-will also be needed for angular separation calculations.
-
-Currently the positions are stored incorrectly even in the ATNF Pulsar
-Database\footnote{See
-http://www.atnf.csiro.au/research/pulsar/psrcat/}. A search ``within
-circular boundary'' with radius of 1 degree from 16:07:00, -00:30:00
-does not return J1607$-$0032, which appears to be 1.05 degrees
-away. This is because the DECJ is returned as +00:32:40.83 (\ie the
-sign of the declination is not preserved). This seems to be a wider
-problem, originating with the \texttt{psrcat} program.
-
-An example of how we can create new columns is the following bit of
-SQL code:
-\begin{verbatim}
-SELECT pulsar_name,filename,data_type,decj_degree,decj_minute,decj_second,
-        (raj_hour+raj_minute/60.+raj_second/3600.)*15 as raj,
-        CASE WHEN pulsar_name LIKE "%-%" 
-             THEN -1.*(abs(decj_degree)+decj_minute/60.+decj_second/3600.)
-             ELSE abs(decj_degree)+decj_minute/60.+decj_second/3600. 
-             END as decj
-FROM observations 
-WHERE abs(decj_degree)<1 
-	and (decj_minute>0 or decj_second>0) 
-ORDER BY pulsar_name;
-\end{verbatim}
-
-
-\subsection{Interacting with the mySQL database}
-
-It is possible to directly query the database via batch mode:
-\begin{quote}
-\texttt{> mysql -u psrdba -p < input-file.sql}
-\end{quote}
-although one still needs to enter the password for psrdba (although it
-can be specified with the option \texttt{--password=<password>}
-instead of \texttt{-p} -- a bit insecure though?). This method appears
-like a good way of interacting with the database, particularly for
-entering the data. It would be a simple matter to have a .sql file
-that contains the commands necessary to create a table and read data
-from a .csv file into that table.
-
-For querying the database, \eg via a conesearch, it would be similar,
-but would need some way of accessing the query parameters.
-
-
-\subsection{Accessing data}
-
-Once the query has been made, we need some way of providing access to
-the data. One way is the way Albert has set up the archive currently,
-whereby you get a link to a tarfile of all your requested data. 
-
-It might be preferable, however, to provide also some way of linking
-to the data that can be returned in an XML page -- \eg provide a link
-or URL in one of the columns to a staging or preview page from which
-one downloads the data. We probably don't want to provide general
-access directly to the data files (although this would be easy!).
-
-
-\section{Other good things to have}
-
-\subsection{Plot of fields}
-
-It may be good to have a diagram showing which fields are
-available. This would be a whole-sky plot showing the field outlines,
-coloured according to whether they are present in the database. This
-might be good as, although the S70 is nominally all the southern sky,
-it is possible/likely that there are missing fields. Also, if the data
-is made public in stages then this gives a good guide as to what is
-available.
-
-The field outlines I would envision being governed by the beam sizes,
-so you would have a series of circles on the sky-plot. These would
-probably not quite overlap, but it would still be a good visual
-guide. 
-
-It might be possible to eventually make the image linkable, so that
-one could click on a region and go straight to the download page for
-that particular file. But this is definitely a ``wish-list'' item.
-
-\end{document}
-% LocalWords:  conesearch metadata
Index: unk/docs/byte_examination
===================================================================
--- /trunk/docs/byte_examination	(revision 486)
+++ 	(revision )
@@ -1,89 +1,0 @@
-This first bit is from the original data file:
-$PTTAPES/PT0278/PT0278_029
-
-
-
-00000000  50 4d 44 31 2e 30 2e 31  2e 31 50 54 30 32 37 38  |PMD1.0.1.1PT0278|
-00000010  20 20 32 39 20 20 20 20  20 20 20 31 30 36 31 32  |  29       10612|
-00000020  32 32 20 20 20 20 20 35  34 30 39 31 20 31 35 3a  |22     54091 15:|
-00000030  30 33 3a 33 39 2e 30 30  30 30 20 20 20 30 37 3a  |03:39.0000   07:|
-00000040  30 30 3a 34 39 2e 37 31  20 35 20 30 34 3a 33 37  |00:49.71 5 04:37|
-00000050  3a 31 35 2e 36 39 36 30  20 20 2d 34 37 3a 31 35  |:15.6960  -47:15|
-00000060  3a 30 38 2e 30 31 30 20  20 20 20 32 35 33 2e 33  |:08.010    253.3|
-00000070  39 34 20 2d 34 31 2e 39  36 34 20 20 20 30 2e 30  |94 -41.964   0.0|
-00000080  30 30 20 20 20 32 34 30  2e 30 20 20 20 20 20 20  |00   240.0      |
-00000090  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
-*
-000000c0  20 20 20 20 20 20 20 20  20 20 20 31 2d 33 2e 30  |           1-3.0|
-000000d0  30 30 30 30 2d 30 2e 32  35 30 30 30 20 31 39 32  |0000-0.25000 192|
-000000e0  20 20 20 30 20 20 31 38  30 34 2e 35 30 30 30 30  |   0  1804.50000|
-000000f0  20 20 20 37 31 31 2e 38  37 35 30 30 20 30 2e 32  |   711.87500 0.2|
-00000100  35 30 30 30 30 30 30 30  20 30 2e 32 35 30 30 30  |50000000 0.25000|
-00000110  30 30 30 30 20 20 20 31  20 20 20 31 20 20 20 20  |0000   1   1    |
-00000120  32 30 34 38 20 30 2e 35  31 32 30 30 20 31 33 33  |2048 0.51200 133|
-00000130  20 31 35 3a 30 33 3a 34  32 2e 31 37 32 33 20 20  | 15:03:42.1723  |
-00000140  20 30 37 3a 30 30 3a 35  34 2e 37 33 20 30 34 3a  | 07:00:54.73 04:|
-00000150  33 37 3a 31 35 2e 36 39  36 30 20 20 2d 34 37 3a  |37:15.6960  -47:|
-00000160  31 35 3a 30 38 2e 30 31  30 20 20 20 20 32 35 33  |15:08.010    253|
-00000170  2e 33 39 34 20 2d 34 31  2e 39 36 34 20 20 33 30  |.394 -41.964  30|
-00000180  2e 35 32 37 20 32 33 31  2e 35 32 37 20 20 20 20  |.527 231.527    |
-00000190  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
-*
-000001f0  20 20 20 20 20 30 2e 30  30 30 30 30 20 30 2e 30  |     0.00000 0.0|
-00000200  30 30 30 30 20 20 20 31  20 20 20 31 4a 30 34 33  |0000   1   1J043|
-00000210  37 2d 34 37 31 35 20 20  20 20 20 20 48 4f 48 5f  |7-4715      HOH_|
-00000220  35 37 36 20 50 41 74 69  6d 65 20 20 20 31 20 31  |576 PAtime   1 1|
-00000230  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
-00000240  30 30 20 20 31 2e 38 38  20 20 20 20 50 41 52 4b  |00  1.88    PARK|
-00000250  45 53 20 20 20 20 20 20  20 37 35 2e 32 35 20 20  |ES       75.25  |
-00000260  20 20 20 20 20 20 20 20  20 38 20 20 20 20 20 20  |         8      |
-00000270  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
-00000280  5a 78 73 9c c1 71 9a 8b  ff c9 cf fc ef ef df 7b  |Zxs..q.........{|
-00000290  ff ff fe df bd 45 df fe  f3 8c 30 65 99 83 6c 84  |.....E....0e..l.|
-000002a0  c7 4b 5e d8 c7 fb e8 7f  f3 ff fe bf 0b e6 33 f9  |.K^...........3.|
-000002b0  c8 b8 f1 81 b7 d7 99 00  77 0c f7 f8 09 23 d2 7f  |........w....#..|
-000002c0  1b 83 ff ff 04 e7 cd b3  80 fa fe 80 d1 90 d6 87  |................|
-000002d0  38 e0 8b ed 78 71 6f 56  be ef 61 f8 ef fe ff 97  |8...xqoV..a.....|
-000002e0  1f d0 e4 c9 07 f8 21 05  fa 08 63 ef 54 5f 5c 64  |......!...c.T_\d|
-000002f0  b3 84 b6 b8 f3 eb 1f c8  c0 8e cb 64 c0 a9 22 a3  |...........d..".|
-00000300  60 3e e9 f9 1b 01 ba 4e  41 53 10 e3 fb ee ff fd  |`>.....NAS......|
-00000310  a8 2c 91 0c 12 48 42 00  74 0a 8b fe 6e 84 bb 78  |.,...HB.t...n..x|
-
-
-
-
-
-
-
-
-
-
-
-
-
-This next bit is from the converted FITS file:
-PM_061222_150342_01.fits
-
-It starts near the beginning of the subint binary table.
-
-000127c0  44 e1 33 00 44 e1 32 80  44 e1 32 00 44 e1 31 80  |D.3.D.2.D.2.D.1.|
-000127d0  44 e1 31 00 44 e1 30 80  3f 80 00 00 3f 80 00 00  |D.1.D.0.?...?...|
-000127e0  3f 80 00 00 3f 80 00 00  3f 80 00 00 3f 80 00 00  |?...?...?...?...|
-*
-00012ad0  3f 80 00 00 3f 80 00 00  00 00 00 00 00 00 00 00  |?...?...........|
-00012ae0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
-*
-00012dd0  00 00 00 00 00 00 00 00  3f 80 00 00 3f 80 00 00  |........?...?...|
-00012de0  3f 80 00 00 3f 80 00 00  3f 80 00 00 3f 80 00 00  |?...?...?...?...|
-*
-000130d0  3f 80 00 00 3f 80 00 00  5a 78 73 9c c1 71 9a 8b  |?...?...Zxs..q..|
-000130e0  ff c9 cf fc ef ef df 7b  ff ff fe df bd 45 df fe  |.......{.....E..|
-000130f0  f3 8c 30 65 99 83 6c 84  c7 4b 5e d8 c7 fb e8 7f  |..0e..l..K^.....|
-00013100  f3 ff fe bf 0b e6 33 f9  c8 b8 f1 81 b7 d7 99 00  |......3.........|
-00013120  80 fa fe 80 d1 90 d6 87  38 e0 8b ed 78 71 6f 56  |........8...xqoV|
-00013130  be ef 61 f8 ef fe ff 97  1f d0 e4 c9 07 f8 21 05  |..a...........!.|
-00013140  fa 08 63 ef 54 5f 5c 64  b3 84 b6 b8 f3 eb 1f c8  |..c.T_\d........|
-00013150  c0 8e cb 64 c0 a9 22 a3  60 3e e9 f9 1b 01 ba 4e  |...d..".`>.....N|
-00013160  41 53 10 e3 fb ee ff fd  a8 2c 91 0c 12 48 42 00  |AS.......,...HB.|
-00013170  74 0a 8b fe 6e 84 bb 78  ae d4 f1 98 dc e6 ee df  |t...n..x........|
-00013180  83 ae 5c 13 f1 63 ad 85  f1 4a db fc d1 07 59 2e  |..\..c...J....Y.|
Index: /trunk/docs/conversionCodeDetails.tex
===================================================================
--- /trunk/docs/conversionCodeDetails.tex	(revision 486)
+++ /trunk/docs/conversionCodeDetails.tex	(revision 1)
@@ -1,8 +1,5 @@
 \documentclass{article}
 \usepackage{natbib}
-%\usepackage{fancyheadings}
-\usepackage{fancyhdr}
-\usepackage{array}
-\usepackage{xspace}
+\usepackage{fancyheadings}
 
 \textwidth=165 mm
@@ -18,13 +15,11 @@
 \cfoot{}
 \rfoot{\thepage}
-\renewcommand{\headrulewidth}{0cm}
-%\setlength{\headrulewidth}{0in}
-
-\newcommand{\eg}{e.g.\xspace}
-\newcommand{\ie}{i.e.\xspace}
+\setlength{\headrulewidth}{0in}
+
+\newcommand{\eg}{e.g.\ }
+\newcommand{\ie}{i.e.\ }
 \newcommand{\fdg}{\hbox{$.\!\!^\circ$}}
-\newcommand{\cfitsio}{\textsc{cfitsio}\xspace}
-\newcommand{\subint}{\textsc{subint}\xspace}
-\newcommand{\move}{\textsc{move}\xspace}
+\newcommand{\cfitsio}{\textsc{cfitsio}}
+\newcommand{\subint}{\textsc{subint}}
 
 \begin{document}
@@ -110,5 +105,5 @@
 
 The actual data (that is, the 1-bit digitised measurements) will be
-written to the ``data'' field of the \subint binary
+written to the ``data'' field of the \subint\ binary
 table. Each block (of length 48kbytes) will be given a separate entry
 in the table, as this is the smallest chunk of data that we have
@@ -118,13 +113,13 @@
 per pointing for each survey, there will be a fixed number of blocks
 for each pointing position, and hence a fixed number of rows in the
-\subint table. The following table summarises the size of the
+\subint\ table. The following table summarises the size of the
 table and the dimensions of each data entry (note that there is no
 polarisation information in any of this data):
 
 \begin{tabular}{lll}
-Survey  &Number of \subint rows &Dimensions of data table\\ 
+Survey  &Number of \subint\ rows &Dimensions of data table\\ 
 \hline
 S70          &330                            &$1536\times256$\\
-PM           &2051                           &$4096\times96$\\
+PM           &2050                           &$4096\times96$\\
 PH           &517                            &$4096\times96$\\
 \end{tabular}
@@ -141,11 +136,11 @@
   position and beam information (and on the survey under
   consideration).
-\item Read first block and write to \subint binary table.
-\item Write supporting data to \subint table -- \eg time, alt,
+\item Read first block and write to \subint\ binary table.
+\item Write supporting data to \subint\ table -- \eg time, alt,
   azimuth, length of subintegration, etc.
 \item Read next block header. Check position and beam information and
   moving flag.
 \item If same position and beam, and not moving, read next block and
-  write as new row to \subint table.
+  write as new row to \subint\ table.
 \item If moving or new beam, close PSRFITS file.
 \item If new position or new beam, construct new PSRFITS file from
@@ -246,4 +241,79 @@
 passed to \verb|fits_write_col_bit|. It is just a matter of making
 sure there is no loss of information.
+
+
+\newpage
+\section{New FITS keywords and changes that need to be made to PSRFITSDEFN}
+
+We detail here any new keywords that need to be added to the primary HDU of
+the PSRFITS file. These are for information that is either not present
+at all in the FITS file, or information that is stored in one of the
+extensions, but would be worth having in the primary HDU for easy examination.
+
+\begin{itemize}
+\item \texttt{BEAMSIZE} (suggested name) -- the size of the beam, so
+  that a reader knows how much area of sky the FITS file covers. It
+  may be better to use the SDFITS standard of \texttt{BMAJ, BMIN \&
+  BPA}. 
+\item \texttt{OBSFREQ} (or similar) -- the central frequency of
+  the observation. This is stored in some of the binary tables
+  (\textsc{history, subint, ...}, but it would be useful to have this
+  upfront as well.
+\item \texttt{DATE-OBS} -- the standard FITS way of presenting the
+  date of the observation.
+\item \texttt{TIMESYS} -- a suggested keyword to indicate the time
+  system being used.
+\item \texttt{EQUINOX} -- the standard FITS way of presenting the
+  equinox \eg 2000.0.
+\item \texttt{RA,DEC,...} -- positional information in a recognisable
+  format, not just \texttt{STT\_CRD1} etc. This is to make it more
+  accessible for users (\ie more obvious what the position is, and
+  potentially recognisable for other software).
+\item \texttt{UT} -- a new field for the UT might be needed in the
+  \subint\ binary table (there isn't one at the moment). The UT
+  is a quantity that should, conceivably, be useful for users of the
+  data. It is calculatable from the LST and the telescope location,
+  but having it present in the file simplifies the searching
+  possibilities. 
+\end{itemize}
+
+Additionally, here is a list of problems with the PSRFITS definition
+that might need changed at the same time:
+\begin{itemize}
+\item The \texttt{TTFORMn} keyword for the \texttt{DATA} entry in the
+  \subint\ table is set to `I' -- for this project this needs
+  to be changed to `X'. This can be done in the software, but will it
+  be better to change the definition?
+\item \texttt{RA\_SUB} and \texttt{DEC\_SUB} in the \subint\
+  binary table currently have units (in the \texttt{TUNIT} entry) of
+  ``turns'' -- not sure why. This should be changed to ``deg''.
+\end{itemize}
+
+Questions that need to be asked about the equivalence between keywords
+in the old and new formats, and also which keywords we need to use in
+the PSRFITS format (some of these are basically policy decisions):
+\begin{itemize}
+\item What positions are we going to give in the PHU (RA/Dec or
+  GL/GB)?
+\item Order of the axes in the \subint\ data entry : the PSRFITS
+  definition has (NBIN,NCH\_FILE,NPOL) in the comments, but I think it
+  should be (NCH\_FILE,NPOL,NBIN), ordered from fastest-varying to
+  slowest-varying index.
+\item How does \texttt{nfilter} (old format) compare to \texttt{NPOL}
+  (in the \subint\ table -- dimensions of the data format). (NB: this
+  is a minor issue, as they are both 1 for all cases to do with this
+  project -- this is a more general question though about how the
+  PSRFITS setup is motivated).
+\item What are the correct values for the standard keywords in the PHU
+  (the ones such as \textsc{frontend} that will not change across the
+  entire survey)? Are these necessary?
+\item What do we put for \textsc{projid} for each survey? (\ie how do
+  we want the survey names recorded?)
+\item A check needed on the definition of \textsc{off\_sub} : I
+  understand it to be the time from the start (as given by the PHU
+  keyword \textsc{ut\_strt}) of the centre of the current
+  subintegration (\ie the centre of the block stored in the data entry
+  of the current row of the \subint\ table). Is this correct?
+\end{itemize}
 
 
@@ -437,4 +507,115 @@
 \end{verbatim}
 
+\subsection{PSRFITS header keywords}
+
+\subsubsection{PHU}
+\begin{verbatim}
+HDRVER  = '2.4             '   / Header version 
+DATE    = **                   / File creation date (YYYY-MM-DDThh:mm:ss UTC)
+OBSERVER= **irrelevant**       / Observer name(s)
+PROJID  = **survey name**      / Project name
+TELESCOP=    telid             / Telescope name
+ANT_X   = **PKS info**         / [m] Antenna ITRF X-coordinate (D)
+ANT_Y   = **PKS info**         / [m] Antenna ITRF Y-coordinate (D)
+ANT_Z   = **PKS info**         / [m] Antenna ITRF Z-coordinate (D)
+FRONTEND= **survey-dependent** / Rx and feed ID
+FD_POLN = **survey-dependent** / LIN or CIRC
+FD_HAND = **survey-dependent** / +/- 1. +1 is LIN:A=X,B=Y, CIRC:A=L,B=R (I)
+FD_SANG = **survey-dependent** / [deg] FA of E vect for equal sig in A&B (E)
+FD_XYPH = **survey-dependent** / [deg] Phase of A^* B for injected cal (E)
+BACKEND = **survey-dependent** / Backend ID
+BECONFIG= **survey-dependent** / Backend configuration file name
+BE_PHASE= **survey-dependent** / 0/+1/-1 BE cross-phase:0 unknown,+/-1 std/rev
+BE_DCC  = **survey-dependent** / 0/1 BE downconversion conjugation corrected
+TCYCLE  = **survey-dependent** / [s] On-line cycle time (D)
+NRCVR   =    nfilter           / Number of receiver channels (I)
+OBS_MODE= **SEARCH? **         / (PSR, CAL, SEARCH)
+SRC_NAME=    pname             / Source or scan ID 
+COORD_MD= **need to choose**   / Coordinate mode (J2000, Gal, Ecliptic, etc.)
+STT_CRD1=    ra/gl_strt        / Start coord 1 (hh:mm:ss.sss or ddd.ddd)
+STT_CRD2=    dec/gb_strt       / Start coord 2 (-dd:mm:ss.sss or -dd.ddd) 
+TRK_MODE= **irrelevant**       / Track mode (TRACK, SCANGC, SCANLAT)
+STP_CRD1=    ra/gl_strt        / Stop coord 1 (hh:mm:ss.sss or ddd.ddd)
+STP_CRD2=    dec/gb_strt       / Stop coord 2 (-dd:mm:ss.sss or -dd.ddd) 
+SCANLEN = **survey-dependent** / [s] Requested scan length (E)
+FD_MODE =    fdcntrl           / Feed track mode - FA, CPA, SPA, TPA
+FA_REQ  =    feed_angle        / [deg] Feed/Posn angle requested (E)
+CAL_MODE= **no information**   / Cal mode (OFF, SYNC, EXT1, EXT2)
+CAL_FREQ= **no information**   / [Hz] Cal modulation frequency (E)
+CAL_DCYC=    cal_cycle         / Cal duty cycle (E)
+CAL_PHS = **no information**   / Cal phase (wrt start time) (E)
+STT_DATE=    date              / Start UT date (YYYY-MM-DD)
+STT_TIME=    ut_strt           / Start UT (hh:mm:ss)
+STT_IMJD=    mjd               / Start MJD (UTC days) (J - long integer)
+STT_SMJD= **calculatable**     / [s] Start time (sec past UTC 00h) (J)
+STT_OFFS= **unclear**          / [s] Start time offset (D)   
+STT_LST =    lst_strt          / [s] Start LST (D)
+\end{verbatim}
+
+\newpage
+\subsubsection{SUBINT table}
+
+For the \textsc{subint} binary table, we only show the \verb|TTYPE|
+keywords, execept where other ones need changing (such as the units
+for RA and Dec -- should be ``deg'' not ``turns''). The weights,
+offsets and scale factors for each channel are undefined, and so will
+be left empty.
+
+\begin{verbatim}
+XTENSION= BINTABLE             / ***** Subintegration data  *****
+BITPIX  =                    8 / N/A
+NAXIS   =                    2 / 2-dimensional binary table
+NAXIS1  =  **TBD**           * / width of table in bytes 
+NAXIS2  =  **TBD**           * / Number of rows in table (NSUBINT)
+PCOUNT  =                    0 / size of special data area
+GCOUNT  =                    1 / one data group (required keyword)
+TFIELDS =                   19 / Number of fields per row
+# 
+INT_TYPE= 'TIME **check?**   ' / Time axis (TIME, BINPHSPERI, BINLNGASC, etc)
+INT_UNIT= 'SEC  **check?**   ' / Unit of time axis (SEC, PHS (0-1), DEG)    
+NCH_FILE=    nchan           * / Number of channels/sub-bands in this file
+NCH_STRT=  0    **check?**   * / Start channel/sub-band number (0 to NCHAN-1)
+EXTNAME = SUBINT               / name of this binary table extension
+#
+TTYPE#  = ISUBINT  blk_cntr    / Subint number
+TTYPE#  = TSUBINT  blk_sec     / Length of subintegration
+TTYPE#  = OFFS_SUB**calculate**/ Offset from Start of subint centre
+TTYPE#  = LST_SUB  lst         / LST at subint centre 
+TTYPE#  = RA_SUB   RA          / RA (J2000) at subint centre
+TUNIT#  = turns   **deg!**     / Units of field
+TTYPE#  = DEC_SUB  Dec         / [turns] Dec (J2000) at subint centre
+TUNIT#  = turns   **deg!**     / Units of field
+TTYPE#  = GLON_SUB  gl         / [deg] Gal longitude at subint centre
+TTYPE#  = GLAT_SUB  gb         / [deg] Gal latitude at subint centre
+TTYPE#  = FD_ANG  feed_angle   / [deg] Feed angle at subint centre
+TTYPE#  = POS_ANG **????**     / [deg] Position angle of feed at subint centre
+TTYPE#  = PAR_ANG  pangle      / [deg] Parallactic angle at subint centre
+                   (PM only -- not in the S70 header since single beam)
+TTYPE#  = TEL_AZ   tel_az      / [deg] Telescope azimuth at subint centre
+TTYPE#  = TEL_ZEN  tel_zen     / [deg] Telescope zenith angle at subint centre
+TTYPE#  = DAT_FREQ**calculate**/ [MHz] Centre frequency for each channel
+TTYPE#  = DAT_WTS  **set to 1**/ Weights for each channel
+TTYPE#  = DAT_OFFS **set to 0**/ Data offset for each channel
+TTYPE#  = DAT_SCL  **set to 1**/ Data scale factor for each channel
+TTYPE#  = DATA                 / Subint data table
+TFORM#  = I    **use nbits**   / NBIN*NCH_FILE*NPOL integers
+TUNIT#  = Jy                   / Units of subint data
+\end{verbatim}
+
+There are two places where we need to do some calculations. The first
+is the \verb|OFFS_SUB| column. As far as I can make out, this column
+is the cumulative time, from the first bit of data in the table, to
+the middle of the set of data in the current row of the table (\ie the
+middle of the current block or subint). This can be calculated based
+on the known length of a block (given by \verb|TSUBINT|) as
+0.5$\times$(2$\times$\verb|ISUBINT|+1)$\times$\verb|TSUBINT|.
+
+The second is the \verb|DAT_FREQ|. This is the frequency value of each
+channel in a given sample. This is easily calculated knowing the
+central frequency of the first channel (existing data file header
+parameter \verb|freq_chan1|) and the number of channels
+(\verb|nchan|).
+
+
 \newpage
 \section{Identification of fields for namespace}
@@ -451,14 +632,14 @@
 TAPENR	     &  &tapenr	     &12  &4    &tapenr      &10  &6    \\
 SCAN\_CNTR   &  &scan\_cntr  &16  &4    &scan\_cntr  &16  &4    \\
-BLK\_CNTR    &  &blk\_cntr   &20  &8    &blk\_cntr   &20  &8    \\
+BLK\_CNTR    &* &blk\_cntr   &20  &8    &blk\_cntr   &20  &8    \\
 DATE	     &* &date	     &28  &8    &date	     &28  &8     \\
 MJD	     &* &mjd	     &36  &8    &mjd	     &36  &8     \\
 UT\_STRT     &* &ut\_strt    &44  &16   &ut\_strt    &44  &16    \\
-LST\_STRT    &  &lst\_strt   &60  &12   &lst\_strt   &60  &12    \\
+LST\_STRT    &* &lst\_strt   &60  &12   &lst\_strt   &60  &12    \\
 COORD\_TYPE  &* &coord\_type &72  &2    &coord\_type &72  &2     \\
-RA\_STRT     &  &ra\_strt    &74  &16   &ra\_strt    &74  &16    \\
-DEC\_STRT    &  &dec\_strt   &90  &16   &dec\_strt   &90  &16    \\
-GL\_STRT     &  &gl\_strt    &106 &8    &gl\_strt    &106 &8     \\
-GB\_STRT     &  &gb\_strt    &114 &8    &gb\_strt    &114 &8     \\
+RA\_STRT     &* &ra\_strt    &74  &16   &ra\_strt    &74  &16    \\
+DEC\_STRT    &* &dec\_strt   &90  &16   &dec\_strt   &90  &16    \\
+GL\_STRT     &* &gl\_strt    &106 &8    &gl\_strt    &106 &8     \\
+GB\_STRT     &* &gb\_strt    &114 &8    &gb\_strt    &114 &8     \\
 FEED\_ANGLE  &* &[RESERVE]   &--- &---  &feed\_angle &122 &8     \\
 OBS\_TIME    &  &[RESERVE]   &--- &---  &obs\_time   &130 &8    \\
@@ -470,16 +651,16 @@
 NCHAN	     &* &nchan	     &220 &2x4  &nchan	     &220 &2x4   \\
 FREQ\_CHAN1  &* &freq\_chan1 &228 &2x12 &freq\_chan1 &228 &2x12  \\
-SAMP\_INT    &* &samp\_int   &252 &2x12 &samp\_int   &252 &2x12 \\
-SAMP\_GRP    &* &samp\_grp   &276 &2x4  &samp\_grp   &276 &2x4  \\
-GRP\_BLK     &* &grp\_blk    &284 &8    &grp\_blk    &284 &8    \\
+SAMP\_INT    &  &samp\_int   &252 &2x12 &samp\_int   &252 &2x12 \\
+SAMP\_GRP    &  &samp\_grp   &276 &2x4  &samp\_grp   &276 &2x4  \\
+GRP\_BLK     &  &grp\_blk    &284 &8    &grp\_blk    &284 &8    \\
 BLK\_SEC     &* &blk\_sec    &292 &8    &blk\_sec    &292 &8     \\
-FDCNTRL	     &  &[RESERVE]   &--- &---  &fdcntrl     &300 &2     \\
+FDCNTRL	     &* &[RESERVE]   &--- &---  &fdcntrl     &300 &2     \\
 DATA\_TYPE   &  &data1	     &300 &4    &data        &302 &2x1  \\
-UT	     &* &ut	     &304 &16   &ut  	     &304 &16   \\
+UT	     &  &ut	     &304 &16   &ut  	     &304 &16   \\
 LST	     &* &lst	     &320 &12   &lst	     &320 &12    \\
 RA	     &* &ra	     &332 &16   &RA	     &332 &16    \\
 DEC	     &* &dec	     &348 &16   &Dec	     &348 &16    \\
-GL	     &  &gl	     &364 &8    &gl	     &364 &8     \\
-GB	     &  &gb	     &372 &8    &gb	     &372 &8     \\
+GL	     &* &gl	     &364 &8    &gl	     &364 &8     \\
+GB	     &* &gb	     &372 &8    &gb	     &372 &8     \\
 TEL\_ZEN     &* &tel\_zen    &380 &8    &tel\_zen    &380 &8     \\
 TEL\_AZ	     &* &tel\_az     &388 &8    &tel\_az     &388 &8     \\
@@ -506,217 +687,8 @@
 PANGLE	     &* &[RESERVE]   &--- &---  &pangle      &598 &8    \\
 SMP\_BSW     &  &[RESERVE]   &--- &---  &smp\_bsw    &606 &8    \\
-CAL\_CYCLE   &  &[RESERVE]   &--- &---  &cal\_cycle  &614 &4    \\
+CAL\_CYCLE   &* &[RESERVE]   &--- &---  &cal\_cycle  &614 &4    \\
 RESERVE      &  &reserve     &602 &38   &reserve     &618 &22   
 \end{tabular}
 }
-
-\section{How keywords are defined.}
-
-In this section we summarise the keywords and other header parameters
-that go into the PSRFITS file, together with their comment field, and
-detail how the value is arrived at. The value will be generated by:
-\begin{itemize}
-\item Some fixed value that is a constant for the particular survey --
-  either a numeric value or a string.
-\item A direct substitution of the existing file's header values
-(written as \eg \verb|<NFILTER>|, using the enumeration setup detailed
-in the previous setction)
-\item A value calculated from one or more header values via some
-  formula. 
-\end{itemize}
-
-In the case of the first option, we sometimes separate according to
-the survey under consideration -- the options for each survey are then
-listed separately.
-
-The keywords are divided according to the extension, where we show the
-PHU and the \subint extensions. We also show new keywords that are
-added to the PHU, that involve information not in the PSRFITS
-definition that will be useful for VO purposes. These are added using
-the \texttt{PSRFits::addNewKeywords()} function.
-
-For the \subint table, we give the column values that are set for each
-block -- the ``Column Title'' is the \texttt{TTFORM\#} parameter in
-the header. Where the columns are multi-valued, we show how the $i$th
-value is calculated.
-
-\subsection{Existing PHU keywords}
-
-\begin{tabular}{|l|>{\setlength{\rightskip}{0pt plus 2cm}}p{7cm}|>{\setlength{\rightskip}{0pt plus 2cm}}p{5cm}|}\hline
-FITS Keyword & Comment field from FITS header & Value \\ \hline\hline
-
-DATE     & File creation date (YYYY-MM-DDThh:mm:ss UTC) & Date of file creation, from \texttt{fits\_get\_system\_time()}.\\\hline
-
-OBSERVER & Observer name(s)                         & \textbf{not set}\\ \hline
-
-PROJID   & Project name                             & Survey-specific project name.\\ \hline
-
-TELESCOP & Telescope name                           & \verb|<TELID>|\\\hline
-
-ANT\_X    & [m] Antenna ITRF X-coordinate (D)       & -4554231.5 \\\hline
-
-ANT\_Y    & [m] Antenna ITRF Y-coordinate (D)       & 2816759.1 \\\hline
-
-ANT\_Z    & [m] Antenna ITRF Z-coordinate (D)       & -3454036.3 \\\hline
-
-FRONTEND & Rx and feed ID                           & \emph{S70}: ``70cm\_Cavity\_Disk'', \emph{PM/PH}: ``20cm\_MB''\\\hline
-
-FD\_POLN  & LIN or CIRC                             & ``LIN'' \\\hline
-
-FD\_HAND  & +/- 1. +1 is LIN:A=X,B=Y, CIRC:A=L,B=R (I) &  \emph{S70}: 0, \emph{PM/PH}: $+1$\\\hline
-
-FD\_SANG  & [deg] FA of E vect for equal sig in A\&B (E) &  \emph{S70}: 0, \emph{PM/PH}: $-90$\\\hline
-
-FD\_XYPH  & [deg] Phase of A\^* B for injected cal (E) &  \emph{S70}: 0, \emph{PM/PH}: 0\\\hline
-
-BACKEND  & Backend ID                               & ``FB\_1BIT''\\ \hline
-
-BECONFIG & Backend configuration file name          & ``'' \\ \hline
-
-BE\_PHASE & 0/+1/-1 BE cross-phase:0 unknown,+/-1 std/rev & 0 \\\hline
-
-BE\_DCC   & 0/1 BE downconversion conjugation corrected & 0 \\\hline
-
-TCYCLE   & [s] On-line cycle time (D)               & 0 \\\hline
-
-NRCVR    & Number of receiver channels (I)          & \verb|<NFILTER>|\\\hline
-
-OBS\_MODE & (PSR, CAL, SEARCH)                      & ``SEARCH'' \\\hline
-
-SRC\_NAME & Source or scan ID                       & \verb|<PSRNAME>| (Note that this will be blank for survey data!)\\\hline
-
-COORD\_MD & Coordinate mode (J2000, Gal, Ecliptic, etc.)& \verb|<COORD_TYPE>|, translated into text.\\ \hline
-
-STT\_CRD1 & Start coord 1 (hh:mm:ss.sss or ddd.ddd) & \verb|<RA>|\\\hline
-
-STT\_CRD2 & Start coord 2 (-dd:mm:ss.sss or -dd.ddd)& \verb|<DEC>|\\\hline
-
-TRK\_MODE & Track mode (TRACK, SCANGC, SCANLAT)     & ``TRACK'' \\\hline
-
-STP\_CRD1 & Stop coord 1 (hh:mm:ss.sss or ddd.ddd)  & \verb|<RA>|\\\hline
-
-STP\_CRD2 & Stop coord 2 (-dd:mm:ss.sss or -dd.ddd) & \verb|<DEC>|\\\hline
-
-SCANLEN  & [s] Requested scan length (E)            & \emph{S70}: 152, \emph{PM}: 2100, \emph{PH}: 265 \\ \hline
-
-FD\_MODE  & Feed track mode - FA, CPA, SPA, TPA     & \emph{S70}: ``FIXED'', \emph{PM/PH}: ``CPA'' \\ \hline
-
-FA\_REQ   & [deg] Feed/Posn angle requested (E)     & \emph{S70}: 0, \emph{PM/PH}: 30 \\ \hline
-
-CAL\_MODE & Cal mode (OFF, SYNC, EXT1, EXT2)        & ``OFF'' \\ \hline
-
-CAL\_FREQ & [Hz] Cal modulation frequency (E)       &  0 \\\hline
-
-CAL\_DCYC & Cal duty cycle (E)                      & 0 \\\hline
-
-CAL\_PHS & Cal phase (wrt start time) (E)           & 0 \\\hline
-
-STT\_DATE & Start UT date (YYYY-MM-DD)              & \verb|<DATE>|, with the century added on to the start, and '/' changed to '-' \\\hline
-
-STT\_TIME & Start UT (hh:mm:ss)                     & \verb|<UT>|\\ \hline
-
-STT\_IMJD & Start MJD (UTC days) (J - long integer) & \verb|<MJD>|\\ \hline
-
-STT\_SMJD & [s] Start time (sec past UTC 00h) (J)   & \verb|<UT>| as a decimal $\times$ 3600.\\ \hline
-
-STT\_OFFS & [s] Start time offset (D)               & 0 \textbf{NEED TO CHECK THIS.}\\ \hline
-
-STT\_LST  & [s] Start LST (D)                       & \verb|<LST>| as a decimal $\times$ 3600.\\ \hline
-\end{tabular}
-
-\subsection{New PHU keywords}
-
-\begin{tabular}%
-{|l|>{\setlength{\rightskip}{0pt plus 2cm}}p{7cm}|>{\setlength{\rightskip}{0pt plus 2cm}}p{5cm}|}\hline
-FITS Keyword & Comment field from FITS header & Value \\ \hline\hline
-
-OBSFREQ  & [MHz] Observing frequency 
-& \verb|<FREQ_CHAN1>| $+$ ((\verb|<NCHAN>|$-1)/2) \times$
-\verb|<CHANBW>| \\ \hline
-
-RA       & Right Ascension & \verb|<RA>| \\ \hline
-
-DEC      & Declination     & \verb|<DEC>| \\ \hline
-
-DATE-OBS & Date of observation (YY-MM-DDThh:mm:ss UTC)  &\verb|<DATE>|, with the century added on to the start, and '/'  changed to '-' \\\hline
-
-EQUINOX  & Equinox         & Either ``1950.0'' or ``2000.0'', if \verb|<COORD_TYPE>| is of one of
-these. \\ \hline
-
-BMAJ     &                 &\emph{S70}: 0.75, \emph{PM/PH}: 0.24 \\ \hline
-
-BMIN     &                 &\emph{S70}: 0.75, \emph{PM/PH}: 0.24 \\ \hline
-
-BPA      &                 &\emph{S70}: 0., \emph{PM/PH}: 0. \\ \hline
-\end{tabular}
-
-
-
-\subsection{SUBINT keywords}
-
-
-\begin{tabular}%
-{|l|>{\setlength{\rightskip}{0pt plus 2cm}}p{7cm}|>{\setlength{\rightskip}{0pt plus 2cm}}p{5cm}|}\hline
-FITS Keyword & Comment field from FITS header & Value \\ \hline\hline
-
-INT\_TYPE & Time axis (TIME, BINPHSPERI, BINLNGASC, etc)   & ``TIME'' \\\hline
-
-INT\_UNIT & Unit of time axis (SEC, PHS (0-1), DEG)        & ``SEC'' \\ \hline
-
-TSAMP     & [s] Sample interval for SEARCH-mode data       & \verb|<SAMP_INT>| $\times$ 1000. \\ \hline
-
-NBIN      & Nr of bins (1 for SEARCH-mode data)            & 1 \\ \hline
-
-NCH\_FILE & Number of channels/sub-bands in this file      & \verb|<NCHAN>| \\ \hline
-
-NCH\_STRT & Start channel/sub-band number (0 to NCHAN-1)   & 0 \\ \hline
-
-NPOL      & Nr of polarisations in table                   & 1 \\ \hline
-
-NSBLK     & Samples/row (each NPOL*NCH\_FILE, SEARCH mode) & \verb|<SAMP_GRP>| $\times$ \verb|<GRP_BLK>| \\ 
-\hline
-\end{tabular}
-
-\subsection{SUBINT columns}
-
-\begin{tabular}%
-{|l|>{\setlength{\rightskip}{0pt plus 2cm}}p{7cm}|>{\setlength{\rightskip}{0pt plus 2cm}}p{5cm}|}\hline
-Column title & Comment field from FITS header & Value \\ 
-\hline\hline
-
-ISUBINT  & Subint number
-& Incremental counter of the number of rows.\\ \hline
-TSUBINT  & Length of subintegration                         & \verb|<BLK_SEC>| \\ \hline
-
-OFFS\_SUB & Offset from Start of subint centre              &$\frac{1}{2}\times(2\times(\verb|<BLK_CNTR>|-(\verb|blk_initial|))+1)\times \verb|<BLK_SEC>|$ \\ \hline
-
-LST\_SUB  & LST at subint centre                            & \verb|<LST>| \\ \hline
-
-RA\_SUB   & RA (J2000) at subint centre                     & \verb|<RA>| \\ \hline
-
-DEC\_SUB  & [turns] Dec (J2000) at subint centre            & \verb|<DEC>| \\ \hline
-
-GLON\_SUB & [deg] Gal longitude at subint centre            & \verb|<GL>| \\ \hline
-
-GLAT\_SUB & [deg] Gal latitude at subint centre             & \verb|<GB>| \\ \hline
-
-FD\_ANG   & [deg] Feed angle at subint centre               & \verb|<FEED_ANGLE>| \\ \hline
-
-POS\_ANG  & [deg] Position angle of feed at subint centre   & \verb|<PANGLE>| \\ \hline
-
-PAR\_ANG  & [deg] Parallactic angle at subint centre        & $(\verb|<FEED_ANGLE>| + \verb|<PANGLE>|) \bmod 360$ \\ \hline
-
-TEL\_AZ   & [deg] Telescope azimuth at subint centre        & \verb|<TEL_AZ>| \\ \hline
-
-TEL\_ZEN  & [deg] Telescope zenith angle at subint centre   & \verb|<TEL_ZEN>| \\ \hline
-
-DAT\_FREQ & [MHz] Centre frequency for each channel         & $\verb|<FREQ_CHAN1>| + i\times\verb|<CHANBW>|$ \\ \hline
-
-DAT\_WTS  & Weights for each channel                        & 1 $\forall i$ \\ \hline
-
-DAT\_OFFS & Data offset for each channel                    & 0 $\forall i$ \\ \hline
-
-DAT\_SCL  & Data scale factor for each channel              & 1 $\forall i$ \\ \hline
-\end{tabular}
 
 \newpage
@@ -818,13 +790,4 @@
 individual keywords and table columns.
 
-\subsection{Positional information}
-
-WARNING! Contrary to first thought, the existing header parameters
-\textsc{ra\_strt} and \textsc{dec\_strt} are not the appropriate ones
-for the \textsc{stt\_crd1,2} FITS keywords. They are the starting
-positions \emph{as far as the file is concerned}, and so are the same
-even when the telescope has moved to a different position. They are
-not the position of the start of the subints for a given sky location! 
-
 \subsection{Storing 1-bit binary data}
 
@@ -844,7 +807,7 @@
 incorporated into a \texttt{fixPSRFITS} function in the PSRFits class.
 
-Next, however, there is a bug in \cfitsio that incorrectly calculates
+Next, however, there is a bug in \cfitsio\ that incorrectly calculates
 the number of bytes for a given number of bits when the `X' datatype
-is being used. This bug is in \texttt{editcol.c} in the \cfitsio
+is being used. This bug is in \texttt{editcol.c} in the \cfitsio\
 distribution and is easily fixed:
 \begin{quote}
@@ -875,113 +838,78 @@
 \item Open Survey file. 
   \begin{itemize}
-  \item Currently, just use \texttt{std::ifstream::open()} to open it. 
+  \item Currently, just use \texttt{fin.open} to open it. 
   \end{itemize}
-
-\item Determine survey from first few bytes of file. Note that there
-  is no difference between the PM and PH surveys, as far as the file
-  format goes.
+\item Determine survey from first few bytes of file. \textbf{Check
+  -- can we determine difference between PM and PH?}
   \begin{itemize}
   \item Use this information to define the Block setup (\eg
     \texttt{DataBlock block("S70");}).
   \end{itemize} 
-
-\item Read first block and obtain beam and moving state for that
-  block. 
+\item Read first block header and construct PSRFITS file based on
+  position and beam information (and on the survey under
+  consideration).
   \begin{itemize}
   \item \texttt{block.readBlock(fin);}
-  \item \texttt{block.telescopeOK();}
-  \item This information will be used to determine future changes in
-  the beam number or the moving state of the telescope.
+  \item Need to find a way to name the fits file. Then open it with:
+    \texttt{PSRFits fitsfile(filename);}
+  \item This should take care of any ``fixes'' that need to be made to
+    the setup.
+  \item Write the PHU of the fits file with
+    \texttt{fitsfile.writePHU(block);} 
   \end{itemize} 
-
-\item\label{step-init} Create a PSRFITS file and initialise based on
-the block information.
-  \begin{itemize}
-  \item Does this with \texttt{PSRFits::initialise(DataBlock \&)}.
-  \item Sets the time, date, beam, initial block and FITS filename. 
-  \item Opens the FITS file, calling the
-    \texttt{PSRFits::fixPSRFITS()} function that corrects any incorrect
-    header keywords.
-  \item Write the PHU of the fits file with
-    \texttt{PSRFits::writePHU(DataBlock \&);} 
-  \item Setup the \subint table with the necessary keywords and
-    DAT\_... arrays.
+\item Record the position, beam information of the first block.
+  \begin{itemize}
+  \item Store as local variables \eg \texttt{currentRA, currentBeam,
+  ...} 
   \end{itemize} 
-
-\item Write the current command-line command to the HISTORY table. 
-
-\item\label{step-data} If the file is open, write the block of data to
-the \subint binary table.
-  \begin{itemize}
-  \item Use the function \texttt{PSRFits::writeSubint(DataBlock \&);}
-  \item Obviously the first time round the file will be open, but it
-  may not be on subsequent occasions.
+\item Read first block and write to \subint\ binary table.
+  \begin{itemize}
+  \item Use the function \texttt{fitsfile.writeSubint(block);}
   \end{itemize} 
-
-\item\label{step-readNew} Read next block header. If we are at the end
-  of the file, go to Step~\#\ref{step-closefile}.
-
-\item If the file is still going (so that the block is valid), check
-  beam information and moving flag.
+\item Write supporting data to \subint\ table -- \eg time, alt,
+  azimuth, length of subintegration, etc.
+  \begin{itemize}
+  \item This is taken care of in the previous stage.
+  \end{itemize} 
+\item Read next block header. Check position and beam information and
+  moving flag.
   \begin{itemize}
   \item Read in the block as before.
-  \item Read the current beam and moving flags (with
-    \texttt{block.getKeyword} and \texttt{block.telescopeOK()}) and
-    compare to local versions.
+  \item Read the position, current beam, moving flags (with
+    \texttt{block.getKeyword}) and compare to local versions.
   \end{itemize} 
-
-\item If the FITS file is deemed to be full, or the beam number has
-  changed, close the file.
-  \begin{itemize}
-  \item See \S\ref{sec-moving} for details on what ``full'' means.
-  \item This is done with \texttt{PSRFits::closeFile()}.
-  \end{itemize}
-
-\item If we were moving, but are now pointing correctly, set up for a
-new file.
-  \begin{itemize}
-  \item This just means setting a flag in the PSRFits class to record
-  the fact that the file is a new one. We do not open a file on disk
-  yet.
-  \end{itemize}
-
-\item If the file is closed, and we are pointing correctly, go to
-  Step~\#\ref{step-init}.
-
-\item If the input file is still open (\ie we have read in another
-  block at Step~\#\ref{step-readNew}), go back to
-  Step~\#\ref{step-data}. If it is not, we are at the end of the
-  file. Go to next step.
-
-\item\label{step-closefile} Close PSRFITS file.
+\item If same position and beam, and not moving, read next block and
+  write as new row to \subint\ table.
+  \begin{itemize}
+  \item If all OK, do another \texttt{fitsfile.writeSubint(block);}
+  \end{itemize} 
+\item If moving or new beam, close PSRFITS file.
+  \begin{itemize}
+  \item If \texttt{block.beam != currentBeam}, keep the fits file
+    open, but open a new one (or switch to one that is already open).
+  \item For a multibeam case, we should have a possibility of 13
+    different fits files, one for each beam. These can all remain open
+    until we move to a new base position.
+  \item If \texttt{block.move == 1}, then we close all open fits files
+    with \texttt{PSRFits::closeFile()}.
+  \item If moving, we keep the locally stored ``currentPosition''
+    variable the same, so that the next step works.
+  \end{itemize} 
+\item If new position or new beam, construct new PSRFITS file from
+  header and then write binary data.
+  \begin{itemize}
+  \item If new beam, and file is not already open, open the fits file
+    using \texttt{PSRFits fitsfile(filename);}. The name is derived
+    from the position/beam somehow.
+  \item Otherwise, it is the same as Step \#3.
+  \end{itemize} 
+\item Continue until end of file. Close PSRFITS file.
   \begin{itemize}
   \item \texttt{PSRFits::closeFile()}.
   \item Need to close the existing survey file as well: \texttt{fin.close()}
   \end{itemize} 
-  
+
+
 \end{enumerate}
-
-\subsection{Details about the MOVE flag}
-\label{sec-moving}
-
-The S70 survey includes many pointings in a given (existing) data
-file. It has a \move flag in the block headers to tell you
-whether the telescope is pointing (01) or moving (02) (or is not doing
-a GRID pattern -- 00). 
-
-The S70 data is taken in a such a way that, after 152sec (or 330
-blocks), the move flag is set to 02, to indicate the telescope is
-about to move. However, the subsequent data is still good.
-
-The number of samples should be at least 512K ($=524288=2^{19}$),
-which requires 342 blocks. We therefore keep reading blocks and
-writing to the \subint table until the later of: \move is set
-to 02; and number of samples $>$ 521K.
-
-An important point to note is that the position, as stored in the
-\textsc{RA} and \textsc{DEC} keywords, will change a few blocks before
-the number of samples reaches 512K, so that the last few rows in the
-\subint table will have different positions to the rest.
-
 
 \end{document}
Index: unk/docs/fakedata_2bit_t11.txt
===================================================================
--- /trunk/docs/fakedata_2bit_t11.txt	(revision 486)
+++ 	(revision )
@@ -1,1 +1,0 @@
-0 0 0 1 0 0 0 1 0 0 0 1 1 0 0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 0 1 1 0 0 0 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 0 0 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1
Index: unk/docs/pvoconvertGuide.tex
===================================================================
--- /trunk/docs/pvoconvertGuide.tex	(revision 486)
+++ 	(revision )
@@ -1,1169 +1,0 @@
-\documentclass[10pt,a4paper]{article}
-\usepackage{natbib}
-%\usepackage{fancyheadings}
-\usepackage{fancyhdr}
-\usepackage{array}
-\usepackage{xspace}
-
-%\textwidth=165 mm
-%\textheight=248 mm
-%\topmargin=-15 mm
-%\oddsidemargin=0 mm
-%\parindent=6 mm
-
-\pagestyle{fancy}
-\rhead{}
-\lhead{}
-\lfoot{\today}
-\cfoot{}
-\rfoot{\thepage}
-\renewcommand{\headrulewidth}{0cm}
-%\setlength{\headrulewidth}{0in}
-
-%Define a test for doing PDF format -- use different code below
-\newif\ifPDF
-\ifx\pdfoutput\undefined\PDFfalse 
-\else\ifnum\pdfoutput > 0\PDFtrue 
-     \else\PDFfalse 
-     \fi 
-\fi
-% If we are creating a PDF, use different options for graphicx, hyperref.
-\ifPDF
-  \usepackage[pdftex]{graphicx,color}
-  \usepackage[pdftex,bookmarks]{hyperref}
-  \hypersetup{colorlinks=true,% 	    
-              citecolor=red,%
-              filecolor=red,%
-              linkcolor=red,%
-              urlcolor=red,%
-              }
-\else
-  \usepackage[dvips]{graphicx} 
-  \usepackage[dvips]{hyperref} 
-\fi
-
-\newcommand{\eg}{e.g.\xspace}
-\newcommand{\ie}{i.e.\xspace}
-\newcommand{\fdg}{\hbox{$.\!\!^\circ$}}
-\newcommand{\cfitsio}{\textsc{cfitsio}\xspace}
-\newcommand{\subint}{\textsc{subint}\xspace}
-\newcommand{\history}{\textsc{history}\xspace}
-\newcommand{\move}{\textsc{move}\xspace}
-\newcommand{\pvoconvert}{\textsc{pvoconvert}\xspace}
-\newcommand{\pvosummary}{\textsc{pvosummary}\xspace}
-\newcommand{\pvoconesearch}{\textsc{pvoconeseach}\xspace}
-\newcommand{\hi}{H\textsc{i}\xspace}
-\begin{document}
-%\titlepage
-\begin{flushright}
-{\huge \pvoconvert }\\
-\vspace{5mm}{\LARGE A Guide}\\
-\vspace{5mm}{\Large Matthew Whiting}
-\end{flushright}
-\tableofcontents
-
-\newpage
-\section{Summary}
-
-This document provides a guide to the motivation behind \pvoconvert
-and the details of how it works. The nature of the existing data is
-briefly described, primarily so that the conversion process can be
-understood. The algorithms involved are described, along with
-particular elements of the code that had to be developed. We also
-describe where the code itself resides and how it should be
-implemented. 
-
-Note: this document supersedes \textit{conversionCodeDetails.tex},
-which was written in the course of the development and so has
-information that is no longer of interest.
-
-\section{Motivation behind \pvoconvert}
-
-This software has been developed as part of a project to make all
-the data from various Parkes pulsar surveys available through an
-online archive. In doing so, we would like the data to be available in
-a standard format, and accessible through standard Virtual Observatory
-(VO) techniques. This has necessitated converting the data from the
-compact tape structures they are stored in currently to a FITS-based
-format that provides standard ways of accessing the meta-data (\ie the
-FITS header information), while preserving the data itself in an
-efficiently stored manner.
-
-There are three different surveys that we will be dealing with. The
-Parkes Southern Pulsar survey, or the 70-cm survey
-\citep[S70,][]{manchester96} is a survey of the entire southern sky
-made with a single beam at a wavelength of 70~cm. The Parkes
-Multi-beam survey \citep[PM,][]{manchester01} is a more sensitive
-survey, done at 21~cm with the 13-beam \hi multi-beam receiver. This
-survey covered only a portion of the Galactic plane. The final survey
-under consideration is the Parkes High-Latitude survey
-\citep[PH,][]{burgay06}, which used the same multi-beam receiver but
-searched out of the Galactic plane in a relatively narrow band of
-longitude (and with different integration times to the PM survey).
-
-
-\newpage
-\section{Existing data format}
-
-The current formats of the data files for all three surveys are very
-similar. Within each file, the data are stored in blocks, where the
-first 640 bytes consist of header information, detailing positional
-and instrumental information, and the next 48kB is the 1-bit digitised
-data. For the S70 data, there is only one beam, so the data block
-consists of successive samples of the $n$ frequency channels (it is
-possible for there to be two filterbanks, in which case the second set
-of channels follows the first -- all the S70 survey data \emph{should}
-have just one filterbank). There must be a whole number of samples to
-fit in the 48kbytes.
-
-For the PM and PH data, there are 13 beams for each sample, and these
-are stored in successive blocks. This means a given file switches
-continually from beam to beam as you move from block to block (and this
-has implications for the way the FITS file will be written).
-
-A given file can have many blocks in it, and they don't all have to be
-at the same sky position. The way the surveys work is to point at a
-given location for a fixed time and then move to the next position,
-taking data as they go. The data that is taken while the telescope is
-moving is flagged as such.
-
-The header information is crucial in the conversion process. As noted,
-the format of this information is largely the same, with slight
-differences between the surveys. The S70 data\footnote{I have been
-examining the data in the directory
-\texttt{/pulsar/archive00/S70\_TAPES/}} appears to follow the format
-given by this file\footnote{\texttt{%
-/pulsar/psr/cvshome/pulsar/soft\_swin\_old/soft\_swin/search/util/sc\_head.inc}}.
-
-The PM data, however, seems to follow this file\footnote{%
-\texttt{/pulsar/psr/cvshome/pulsar/soft\_atnf/search/sc\_td/sc\_pmhead.inc}},
-which is somewhat newer and has slightly different headers in some
-cases (for instance, where there are comments in the S70 data, there
-is space for attenuator settings).
-
-
-We summarise in Table~\ref{tab-surveys} the details of each
-survey. The last two lines indicate the amount of disk space required
-for all data for one pointing, and for the whole survey. Note that the
-headers are not included here, but the size of the PSRFITS header is
-about 80~kB, so this would add about 3-6~GB to the total Survey size
-for each survey.
-
-\begin{center}
-\begin{table}[h]
-\begin{tabular}{l|lll}
-                        &S70     &PM              &PH\\ \hline
-Telescope               &Parkes  &Parkes          &Parkes\\
-Receiver                &70-cm   &21-cm multibeam &21-cm multibeam\\
-\# Beams/pointing       &1       &13              &13\\
-HPBW [arcmin]           &45      &14.2            &14.2\\
-Frequency [MHz]         &436     &1374            &1374\\
-Bandpass [MHz]          &32      &288             &288\\
-\# Channels             &256     &96              &96\\
-\# Polarisations        &1       &1               &1\\
-Sampling time [$\mu$s]  &300     &250             &125\\
-Digitisation            &1 bit   &1 bit           &1 bit\\
-Time/pointing [sec]     &152     &2100 = 35~min   &265\\
-Total Survey Pointings  &44,299  &2,670           &6,456\\
-Total Survey Beams      &44,299  &34,710          &83,928\\
-Disk Size of 1 file     &15.5~MB &96.1~MB         &24.3~MB\\
-Disk Size of Survey     &692~GB  &3.18~TB         &1.94~TB\\
-\end{tabular}
-\caption{Comparison of the three surveys under consideration.}
-\label{tab-surveys}
-\end{table} 
-\end{center}
-
-\newpage
-\section{Output format}
-
-We convert the data into a FITS format, using an updated version of
-the PSRFITS format \citep{hotan04}. This has a Primary Header Data
-Unit (PHU) that records a lot of the basic metadata for the FITS file:
-information such as time \& date of observation, RA, Dec, observing
-frequency, integration time, instrument setup, and so on. There are
-also a number of binary table extensions that follow the PHU. The only
-two that are used by \pvoconvert are the \history (containing a record
-of the processing of the data) and \subint (containing the actual data)
-tables. 
-
-The survey observations were performed by pointing at a fixed point on
-the sky for a given integration time, then slewing the telescope to
-the next point. The data is continually being taken in this
-process. Each of the existing tape files will have more than one sky
-position in them. To make archive searching simpler, we have stored
-the data such that each sky position is stored in its own FITS
-file. Note that this means each \emph{beam} for multibeam observations
-is given a separate file, and so the multibeam data will need to be
-broken up according to the beam number.
-
-The resultant FITS files will then be unique according to the time
-at which they were observed, and so we use the time and date to form
-the filename, together with the survey type. The format of the
-filenames are:
-\begin{itemize}
-\item S70 data: \texttt{S70\_YYMMDD\_hhmmss.fits}
-\item PM  data: \texttt{PM\_YYMMDD\_hhmmss\_BB.fits}
-\item PH  data: \texttt{PH\_YYMMDD\_hhmmss\_BB.fits}
-\end{itemize}
-where the date of observations was YY/MM/DD (the year is given in
-two-digit format), the UT time was hh:mm:ss, and, for the multibeam
-case, the beam number is BB (from 01 to 13).
-
-The actual data (that is, the 1-bit digitised measurements) will be
-written to the ``data'' field of the \subint binary
-table. Each block (of length 48kbytes) is given a separate entry
-in the table, as this is the smallest chunk of data that we have
-information about (\eg time and position information from the
-header). The dimensions of each entry will be (\# samples per
-block)$\times$(\# channels per sample). Since there is a fixed time
-per pointing for each survey, there will be a fixed number of blocks
-for each pointing position, and hence a fixed number of rows in the
-\subint table. The following table summarises the size of the
-table and the dimensions of each data entry (note that there is no
-polarisation information in any of this data):
-
-\begin{table}[h]
-\begin{tabular}{lll}
-Survey  &Number of \subint rows &Dimensions of data table\\ 
-\hline
-S70          &330                            &$1536\times256$\\
-PM           &2051                           &$4096\times96$\\
-PH           &517                            &$4096\times96$\\
-\end{tabular}
-\caption{The size of the \subint data table for each survey.}
-\label{tab-datasize}
-\end{table}
-
-\newpage
-\section{Algorithm}
-
-Here we summarise the \pvoconvert algorithm, looking at what variables
-need to be examined and what functions will need to be called. Some
-classes and functions are referred to -- these are detailed in the
-next section.
-
-\begin{enumerate}
-
-\item Open Survey file. 
-  \begin{itemize}
-  \item Use \texttt{std::ifstream::open()} to open it. 
-  \end{itemize}
-
-\item Determine survey from first few bytes of file. Note that there
-  is no difference between the PM and PH surveys, as far as the file
-  format goes, just a difference in some parameter values.
-  \begin{itemize}
-  \item Use this information to define the Block setup (\eg
-    \texttt{DataBlock block("S70");}).
-  \end{itemize} 
-
-\item Read first block and obtain beam and moving state for that
-  block. 
-  \begin{itemize}
-  \item \texttt{block.readBlock(fin);}
-  \item \texttt{block.telescopeOK();}
-  \item This information will be used to determine future changes in
-  the beam number or the moving state of the telescope.
-  \end{itemize} 
-
-\item\label{step-init} Create a PSRFITS file and initialise based on
-the block information.
-  \begin{itemize}
-  \item Does this with \texttt{PSRFits::initialise(DataBlock \&)}.
-  \item Sets the time, date, beam, initial block and FITS filename. 
-  \item Opens the FITS file, calling the
-    \texttt{PSRFits::fixPSRFITS()} function that corrects any incorrect
-    header keywords.
-  \item Write the PHU of the fits file with
-    \texttt{PSRFits::writePHU(DataBlock \&);} 
-  \item Setup the \subint table with the necessary keywords and
-    DAT\_... arrays.
-  \end{itemize} 
-
-\item Write the current command-line command to the HISTORY table. 
-
-\item\label{step-data} If the file is open, write the block of data to
-the \subint binary table.
-  \begin{itemize}
-  \item Use the function \texttt{PSRFits::writeSubint(DataBlock \&);}
-  \item Obviously the first time round the file will be open, but it
-  may not be on subsequent occasions.
-  \end{itemize} 
-
-\item\label{step-readNew} Read next block header. If we are at the end
-  of the file, go to Step~\#\ref{step-closefile}.
-
-\item If the file is still going (so that the block is valid), check
-  beam information and moving flag.
-  \begin{itemize}
-  \item Read in the block as before.
-  \item Read the current beam and moving flags (with
-    \texttt{block.getKeyword} and \texttt{block.telescopeOK()}) and
-    compare to local versions.
-  \end{itemize} 
-
-\item If the FITS file is deemed to be full, or the beam number has
-  changed, close the file.
-  \begin{itemize}
-  \item See \S\ref{sec-moving} for details on what ``full'' means.
-  \item This is done with \texttt{PSRFits::closeFile()}.
-  \end{itemize}
-
-\item If we were moving, but are now pointing correctly, set up for a
-new file.
-  \begin{itemize}
-  \item This just means setting a flag in the PSRFits class to record
-  the fact that the file is a new one. We do not open a file on disk
-  yet.
-  \end{itemize}
-
-\item If the file is closed, and we are pointing correctly, go to
-  Step~\#\ref{step-init}.
-
-\item If the input file is still open (\ie we have read in another
-  block at Step~\#\ref{step-readNew}), go back to
-  Step~\#\ref{step-data}. If it is not, we are at the end of the
-  file. Go to next step.
-
-\item\label{step-closefile} Close PSRFITS file.
-  \begin{itemize}
-  \item \texttt{PSRFits::closeFile()}.
-  \item Need to close the existing survey file as well: \texttt{fin.close()}
-  \end{itemize} 
-  
-\end{enumerate}
-
-\newpage
-\section{Implementation}
-
-In this section, we discuss in more detail aspects of the \pvoconvert
-code: how it is implemented and what particular methods were required
-due to the peculiarities of the data.
-
-\subsection{Design of code}
-
-The code is written in C++: this was chosen so that several features
-in particular could be used, namely the classes and namespaces that
-C++ does better than C. The code makes use of the \cfitsio library to
-create and write to FITS files, using the psrheader.fits template
-file\footnote{\texttt{/pulsar/psr/linux/share/psrheader.fits}, pointed
-to by environment variable \texttt{\$PSRFITSDEFN}.} to define the
-structure of the PSRFITS file.
-
-There are three main classes that are used to manipulate the data and
-metadata. The primary one is the \texttt{PVO::FITS::PSRFits} class. This holds
-the information about the PSRFITS file: filenames of new and old
-files, time and date of the start of the data, beam number if needed,
-and a class containing data for the \subint table. This class,
-\texttt{PVO::FITS::Subint} holds all the information needed to populate the
-\subint binary table, both the header and the table cells themselves,
-with the exception of the actual observation data.
-
-Another class, \texttt{PVO::Block::DataBlock} keeps all information
-for a given block (640 byte header + 48kbyte data) in the old
-file. The header is stored as an STL string, while the data is stored
-as bytes in an array of chars. The class also records information
-about the type of survey and the rules for reading the header string
-(which differ for each survey). These rules are stored using the final
-class, \texttt{PVO::Header::SurveySchema}. It records the location and
-length of each header parameter in the existing header blocks, and
-provides functionality to extract a desired keyword (thereby hiding
-the location from the user). It also records certain parameters that
-are not stored in the header block, but are fixed for a given survey
-and are required by the PSRFITS PHU (such as the beam size, the
-instrumental configurations, the antenna locations).
-
-
-\subsection{Opening/reading existing data files}
-
-The different data formats for the different surveys can be
-distinguished by the first few bytes of the file. The S70 data has the
-first four bytes as \texttt{b6 6d 6d db} in hex (note that \texttt{6d}
-is \texttt{``m''} in ASCII., while the multibeam data files commence
-with \texttt{``PMD''} (in ASCII). So it is possible to
-discriminate between the different types upon reading the first few
-bytes of the file.
-
-\pvoconvert then reads the first few bytes, determines the survey
-type, and uses this to set up the \texttt{SurveySchema} class. This
-defines how the tape files' headers will be read and interpreted, to
-ensure the correct metadata is extracted and the correct FITS keywords
-are populated. Summaries of which headers go to which keywords are
-given in Appendix~\ref{app-headers}. The \texttt{SurveySchema} class
-uses \texttt{enum} labels to associate a given header parameter with a
-location in the header string. These labels are listed in
-Appendix~\ref{app-headerFields}, together with the header parameters
-they correspond to for each survey and their location in the 640-byte
-string. 
-
-\subsection{How we know when a FITS file is finished}
-\label{sec-moving}
-
-The S70 survey includes many pointings in a given (existing) data
-file. It has a \move flag in the block headers to tell you
-whether the telescope is pointing (01) or moving (02) (or is not doing
-a GRID pattern -- 00). 
-
-The S70 data is taken in a such a way that, after 152sec (or 330
-blocks), the move flag is set to 02, to indicate the telescope is
-about to move. However, the subsequent data is still good.
-
-The number of samples should be at least 512K ($=524288=2^{19}$),
-which requires 342 blocks. We therefore keep reading blocks and
-writing to the \subint table until the later of: \move is set
-to 02; and number of samples $>$ 521K.
-
-An important point to note is that the position, as stored in the
-\textsc{RA} and \textsc{DEC} keywords, will change a few blocks before
-the number of samples reaches 512K, so that the last few rows in the
-\subint table will have different positions to the rest.
-
-
-\newpage
-\section{Location of code and usage}
-
-\subsection{Location}
-
-The software has been developed in a local directory on my data disk%
-\footnote{\texttt{/DATA/SITAR\_1/whi550/VO/PulsarVO/src}}. This has
-been kept under revision control using the Subversion system, and
-visible on the ATNF sourcecode website or through the Trac webpage% 
-\footnote{%
-\href{http://sourcecode.atnf.csiro.au/cgi-bin/trac\_pulsarvo.cgi}%
-{http://sourcecode.atnf.csiro.au/cgi-bin/trac\_pulsarvo.cgi}}
-associated with it.
-
-The working code, however, has been installed in the pulsar
-filesystem, in the directory \texttt{/pulsar/psr/pvo}, where a
-Makefile uses the standard make system to install the executables in
-the directory \texttt{/psr/linux/bin} (in the case of installation on
-a linux machine).
-
-\subsection{How to run \pvoconvert}
-
-The program is run very simply. If you have an existing tape file, \eg
-S31201, then you can convert it by typing
-\begin{quote}
-\texttt{> pvoconvert S31201}
-\end{quote}
-
-More than one file can be done at once, and wildcards can be accepted
-according to the usual shell rules \eg
-\begin{quote}
-\texttt{> pvoconvert S31201 S31204 S3131*}
-\end{quote}
-
-If the datafile is from the PH Survey, you need to say so explicitly
-so that \pvoconvert knows to apply the PH settings (as the PH files
-have the same basic structure as the PM ones). This is done by using
-the \texttt{-H} flag:
-\begin{quote}
-\texttt{> pvoconvert -H <file(s)>}\hspace{1cm}\\
-\texttt{> pvoconvert --highlat <file(s)>}
-\end{quote}
-If a list of files is provided, and some are S70 files, they will be
-processed according to the S70 setup. However, you cannot provide a
-mix of PH and PM files, as all will get processed in the same way. 
-
-Other possible flags are \texttt{-h} or \texttt{--help} to provide a
-help message, and \texttt{-v} or \texttt{--verbose} to set verbose
-mode for maximum information for any error or warning messages.
-
-\section{Other PulsarVO programs}
-
-We briefly detail here two utility programs that have been developed
-for use with the newly created FITS files. They are not sufficiently
-complex to warrant their own document.
-
-\subsection{\pvosummary}
-
-This is a utility program to print out key metadata from PSRFITS
-files. The standard functionality of this program is to print out
-basic information about a FITS file: filename, RA, Dec, Beam size,
-Frequency, Date of Observation. It can also produce a csv file that
-lists many more parameters -- the full list, obtainable from
-\texttt{pvosummary -p}, is:
-{\small
-\begin{verbatim}
-Basic parameters written to screen:
- FILENAME       The FITS file.
- RAJ            Right Ascension, hh:mm:ss.ss
- DECJ           Declination, dd:mm:ss.sss 
- BEAM FWHM      The average full-width-half-maximum of the beam
-                 (averaged between BMAJ and BMIN)
- OBSFREQ        The central observing frequency
- DATE-OBS       The UT time and date of the observation, in FITS
-                 format YYYY-MM-DDThh:mm:ss.ssss
-
-Additional parameters included only in csv file:
- File Location  The full path of the FITS file.
- Header Version The version of the PSRFITS definition used.
- Source Name    The SRC_NAME keyword.
- RAJd           Right Ascension, in decimal degrees.
- DecJd          Declination, in decimal degrees.
- BMAJ           The FWHM of the major axis of the beam.
- BMIN           The FWHM of the minor axis of the beam.
- BPA            The position angle of the beam.
- ChanBW         The channel bandwidth (from the HISTORY table).
- Nchan          Number of channels (from the HISTORY table).
- Scan length    The SCANLEN keyword.
- Tbin           Time per bin [ms] (from the HISTORY table).
-\end{verbatim}
-
-\subsection{\pvoconesearch}
-
-
-\bibliographystyle{mn2e}
-\bibliography{mnrasmnemonic,pulsars}
-
-
-\newpage
-\section{Step-by-step guide to algorithm}
-
-
-\subsection{Writing the FITS file}
-
-Here we summarise the main \cfitsio routines that will be used
-to open, create, write, and close the FITS file:
-
-\begin{itemize}
-\item \verb|fits_create_template| -- uses the template FITS definition
-  to create a FITS file with all the correct keywords.
-\item \verb|fits_moveabs_hdu| -- use this to move to the primary HDU.
-\item \verb|fits_movenam_hdu| -- use this to move to particular
-  (named) HDUs in the FITS file \eg SUBINT, HISTORY, ...
-\item \verb|fits_update_key| -- add the value of keywords (the
-  keywords should already be there, but if not they get appended).
-\item \verb|fits_get_num_rows| -- get the number of rows in the binary
-  table.
-\item \verb|fits_insert_rows| -- add a new row to the binary table
-  (used when adding the next block).
-\item \verb|fits_write_tdim| -- write the TDIM\# information for a
-  binary table entry that is a multidimensional array.
-\item \verb|fits_get_colnum| -- get the column number of a named
-  column in a binary table.
-\item \verb|fits_write_col| -- write data to a column of a binary
-  table. May need to do this one row at a time, so want to specify the
-  last row (\ie the highest row number present in the table) as the
-  \texttt{firstrow} argument.
-\item \verb|fits_write_col_bit| -- write 1-bit data to a column of a
-  binary table (see note in next subsection about writing 1-bit data).
-\item \verb|fits_close_file| -- obviously, closes the file once we're
-  done. 
-\end{itemize}
-
-
-\subsection{Writing the data to the FITS file's binary table}
-\label{sec-1bit1st}
-
-When the actual data (as opposed to the header information) gets
-written to the binary table, it needs to be stored as 1-bit data (else
-the storage requirements will blow out), and the datatype given by the
-TFORM keyword needs to 'X'. The writing can be accomplished in a
-couple of ways:
-
-\begin{enumerate}
-\item Use \verb|fits_write_col_bit|, giving an array of characters
-  that are either true (\ie not equal to zero) for a bit value of 1,
-  or false (\ie equal to zero) for a bit value of 0.
-\item Use \verb|fits_write_col|, writing 8 bits at a time, giving an
-  array of 8-bit integers by specifying the TBYTE datatype.
-\end{enumerate}
-
-The latter method might be the best option, as it is much less memory
-intensive. For instance, if one read a character from the existing
-data, that is 1 byte or 8 bits, and so 8 separate measurements. This
-will translate into 8 characters (and hence 8 \emph{bytes}) to be
-passed to \verb|fits_write_col_bit|. It is just a matter of making
-sure there is no loss of information.
-
-
-\newpage
-\appendix
-\newpage
-\section{Conversion of header keywords}
-\label{app-headers}
-
-The following pages show how the header parameters listed in the
-existing survey data map to header keywords in the PSRFITS file. The
-parameter names are listed as they are described in the definition
-files, along with their size in bytes (and their length, if they are
-arrays -- this is done in FORTRAN format). 
-
-Alongside the parameter names are the PSRFITS keywords that each
-parameter maps to. These are labelled by the header unit that the
-keyword belongs to: \eg \verb|PHU -> STT_DATE| means the keyword
-\verb|STT_DATE| in the Primary HDU (abbreviated herein as PHU).
-
-Not all parameters have a place in the PSRFITS structure. Those
-without a clear place to go have their comments bracketed by \verb|**|
--- many of these are simply irrelevant for the PSRFITS data structure,
-while some may need the appropriate keyword to be added to the PSRFITS
-definition. 
-
-The third sub-section of this appendix goes the other way, and
-indicates what keywords in the PSRFITS header are defined and which
-will need some input from elsewhere. This input, where necessary, will
-be of a generic nature -- such as telescope information -- that will
-most likely be able to be hard-coded into the conversion program. We
-only discuss the primary HDU and the \textsc{subint} binary table, as
-these are the two most important extensions.
-
-\newpage
-\subsection{S70 survey}
-{\footnotesize
-\begin{verbatim}
- synch_hd*8,         :  Used to determine Survey type
- version_hd*4,       :  
- tapenr_hd*4,        :  
- scan_cntr_hd*4,     :  
- blk_cntr_hd*8,      :  Used to record the initial block of a FITS file.
- date_hd*8,          :  PHU -> STT_DATE, plus FITS filename
- mjd_hd*8,           :  PHU -> STT_IMJD
- ut_strt_hd*16,      :  PHU -> STT_TIME
- lst_strt_hd*12,     :  PHU -> STT_LST	
- coord_type_hd*2     :  PHU -> COORD_MD
-	
- ra_strt_hd*16,      :  PHU -> STT_CRD1
- dec_strt_hd*16,     :  PHU -> STT_CRD2
- gl_strt_hd*8,       :  PHU -> STT_CRD1
- gb_strt_hd*8,       :  PHU -> STT_CRD2
- scan_rate_hd*8,     :
- scan_len_hd*8,      :
- comment_hd*64,      :  PHU -> SRC_NAME (only the Field ID Gxxxxx)
- nfilter_hd*2,       :  PHU -> NRCVR
- chanbw_hd(2)*8,     :  SUBINT -> FREQ,     PHU->OBSFREQ
- nchan_hd(2)*4,      :  SUBINT -> NCH_FILE, PHU->OBSFREQ
- freq_chan1_hd(2)*12 :  SUBINT -> DAT_FREQ, PHU->OBSFREQ
-		      
- samp_int_hd(2)*12,  :  SUBINT -> TBIN, TSAMP
- samp_grp_hd(2)*4,   :  Used to keep track of the number of samples
- grp_blk_hd*8,       :  Used to keep track of the number of samples
- blk_sec_hd*8,       :  SUBINT -> TSUBINT, OFFSUB
- data1_hd*4,         :
- ut_hd*16,           :  PHU -> DATE_OBS, plus FITS filename
- lst_hd*12,          :  SUBINT -> LST_SUB   
- RA_hd*16,           :  SUBINT -> RA_SUB     
- Dec_hd*16,          :  SUBINT -> DEC_SUB   
- gl_hd*8,            :  SUBINT -> GLON_SUB 
- gb_hd*8,            :  SUBINT -> GLAT_SUB 
- tel_zen_hd*8        :  SUBINT -> TEL_AZ     
-		      						       
- tel_az_hd*8,        :  SUBINT -> TEL_ZEN 
- status_hd(4)*8,     :
- tpower_hd(8)*8,     :
- nblk_read_hd*8,     :
- scan_ratel_hd*8,    :
- scan_rateb_hd*8,    :
- byte_grp_hd*4,      :
- ibeam_hd*4,         :  Not used for S70 data -- only one beam.
- psrname_hd*12,      :
- data2_hd*4,         :
- obs_filen_hd*16,    :
- nbits_hd(2)*2,      :  SUBINT -> TFORM for DATA field
- ddm_hd*8,           :
- nddch_hd(2)*4,      :
- move_hd*2,          :  Used to determine whether scan has finished.
- pnterr_hd*6,        :
- tree_hd*2,          :
- nsys_hd*2,          :
- telid_hd*10,        :  PHU -> TELESCOP
- nbeam_hd*4,         :
- reserve*38          :  ** blank field to fill up 640 bytes **
-\end{verbatim}
-}
-\newpage
-\subsection{Multibeam data}
-{\footnotesize
-\begin{verbatim}
- program_hd*6        :  Used to determine Survey type
- version_hd*4        :
- tapenr_hd*6         :
- file_cntr_hd*4      :
- blk_cntr_hd*8       :  Used to record the initial block of a FITS file.
- date_hd*8           :  PHU -> STT_DATE
- mjd_hd*8            :  PHU -> STT_IMJD
- ut_strt_hd*16       :  PHU -> STT_TIME
- lst_strt_hd*12      :  PHU -> STT_LST
- coord_type_hd*2     :  PHU -> COORD_MD
- ra_strt_hd*16       :  PHU -> STT_CRD1  (if coord_type=J2000)
- dec_strt_hd*16      :  PHU -> STT_CRD2
- gl_strt_hd*8        :  PHU -> STT_CRD1  (if coord_type=Galactic)
- gb_strt_hd*8        :  PHU -> STT_CRD2	
- feed_angle_hd*8     :  PHU -> FA_REQ, SUBINT->FD_ANG
- obs_time_hd*8       : 
- comment_hd*64       : 
- nfilter_hd*2        :  PHU -> NRCVR
- chanbw_hd(2)*8      :  SUBINT -> FREQ,     PHU->OBSFREQ
- nchan_hd(2)*4       :  SUBINT -> NCH_FILE, PHU->OBSFREQ
- freq_chan1_hd(2)*12 :  SUBINT -> DAT_FREQ, PHU->OBSFREQ
-
- samp_int_hd(2)*12   :  SUBINT -> TBIN, TSAMP			   
- samp_grp_hd(2)*4    :	Used to keep track of the number of samples
- grp_blk_hd*8        :	Used to keep track of the number of samples
- blk_sec_hd*8        :  SUBINT -> TSUBINT 
- fdcntrl_hd*2        :  PHU -> FD_MODE
- data_hd(2)*1        :
- ut_hd*16            :  PHU -> DATE_OBS, plus FITS filename
- lst_hd*12           :  SUBINT -> LST_SUB  
- RA_hd*16            :  SUBINT -> RA_SUB   
- Dec_hd*16           :  SUBINT -> DEC_SUB  
- gl_hd*8             :  SUBINT -> GLON_SUB 
- gb_hd*8             :  SUBINT -> GLAT_SUB 
- tel_zen_hd*8        :  SUBINT -> TEL_AZ   
-					   	   
- tel_az_hd*8         :  SUBINT -> TEL_ZEN   
- atten_hd(4)*4       :
- tpower_hd(20)*4     :
- nblk_read_hd*8      :
- scan_ratel_hd*8     :
- scan_rateb_hd*8     :
- nbeam_hd*4          :
- ibeam_hd*4          :  Goes in FITS filename.
- pname_hd*16         :  PHU -> SRC_NAME  (not necessarily a pulsar name though)
- obs_filen_hd*16     :
- nbits_hd(2)*2       :  SUBINT -> TFORM for DATA entry
- ddm_hd*8            :
- nddch_hd(2)*4       :
- move_hd*2           :  Used to determine if scan has finished
- pnterr_hd*6         :
- tree_hd*2           :
- nsys_hd*2           :
- telid_hd*10         :  PHU -> TELESCOP
- pangle_hd*8         :  SUBINT -> PAR_ANG 
- smp_bsw_hd*8        :
- cal_cycle_hd*4      :  PHU -> CAL_DCYC
-\end{verbatim}
-}
-
-\newpage
-\section{Identification of fields for namespace}
-\label{app-headerFields}
-
-{\scriptsize
-\begin{tabular}{l|c|lll|lll}
-ENUM keyword &used? &S70 parameter &start &width 
-                                      &PM parameter &start &width\\
- \hline
-
-CODE         &  &synch       &0   &8    &program     &0   &6    \\
-VERSION      &  &version     &8   &4    &version     &6   &4    \\
-TAPENR	     &  &tapenr	     &12  &4    &tapenr      &10  &6    \\
-SCAN\_CNTR   &  &scan\_cntr  &16  &4    &scan\_cntr  &16  &4    \\
-BLK\_CNTR    &  &blk\_cntr   &20  &8    &blk\_cntr   &20  &8    \\
-DATE	     &* &date	     &28  &8    &date	     &28  &8     \\
-MJD	     &* &mjd	     &36  &8    &mjd	     &36  &8     \\
-UT\_STRT     &* &ut\_strt    &44  &16   &ut\_strt    &44  &16    \\
-LST\_STRT    &  &lst\_strt   &60  &12   &lst\_strt   &60  &12    \\
-COORD\_TYPE  &* &coord\_type &72  &2    &coord\_type &72  &2     \\
-RA\_STRT     &  &ra\_strt    &74  &16   &ra\_strt    &74  &16    \\
-DEC\_STRT    &  &dec\_strt   &90  &16   &dec\_strt   &90  &16    \\
-GL\_STRT     &  &gl\_strt    &106 &8    &gl\_strt    &106 &8     \\
-GB\_STRT     &  &gb\_strt    &114 &8    &gb\_strt    &114 &8     \\
-FEED\_ANGLE  &* &[RESERVE]   &--- &---  &feed\_angle &122 &8     \\
-OBS\_TIME    &  &[RESERVE]   &--- &---  &obs\_time   &130 &8    \\
-SCAN\_RATE   &  &scan\_rate  &122 &8    &[RESERVE]   &--- &---  \\
-SCAN\_LEN    &  &scan\_len   &130 &8    &[RESERVE]   &--- &---  \\
-COMMENT      &  &comment     &138 &64   &comment     &138 &64   \\
-NFILTER	     &* &nfilter     &202 &2    &nfilter     &202 &2     \\
-CHANBW	     &* &chanbw	     &204 &2x8  &chanb       &204 &2x8   \\
-NCHAN	     &* &nchan	     &220 &2x4  &nchan	     &220 &2x4   \\
-FREQ\_CHAN1  &* &freq\_chan1 &228 &2x12 &freq\_chan1 &228 &2x12  \\
-SAMP\_INT    &* &samp\_int   &252 &2x12 &samp\_int   &252 &2x12 \\
-SAMP\_GRP    &* &samp\_grp   &276 &2x4  &samp\_grp   &276 &2x4  \\
-GRP\_BLK     &* &grp\_blk    &284 &8    &grp\_blk    &284 &8    \\
-BLK\_SEC     &* &blk\_sec    &292 &8    &blk\_sec    &292 &8     \\
-FDCNTRL	     &  &[RESERVE]   &--- &---  &fdcntrl     &300 &2     \\
-DATA\_TYPE   &  &data1	     &300 &4    &data        &302 &2x1  \\
-UT	     &* &ut	     &304 &16   &ut  	     &304 &16   \\
-LST	     &* &lst	     &320 &12   &lst	     &320 &12    \\
-RA	     &* &ra	     &332 &16   &RA	     &332 &16    \\
-DEC	     &* &dec	     &348 &16   &Dec	     &348 &16    \\
-GL	     &  &gl	     &364 &8    &gl	     &364 &8     \\
-GB	     &  &gb	     &372 &8    &gb	     &372 &8     \\
-TEL\_ZEN     &* &tel\_zen    &380 &8    &tel\_zen    &380 &8     \\
-TEL\_AZ	     &* &tel\_az     &388 &8    &tel\_az     &388 &8     \\
-STATUS	     &  &status	     &396 &4x8  &[RESERVE]   &--- &---  \\
-ATTEN	     &? &[RESERVE]   &--- &---  &atten	     &396 &4x4   \\
-TPOWER	     &  &tpower	     &428 &8x8  &tpower      &412 &20x4 \\
-NBLK\_READ   &  &nblk\_read  &492 &8    &nblk\_read  &492 &8    \\
-SCAN\_RATEL  &  &scan\_ratel &500 &8    &scan\_ratel &500 &8    \\
-SCAN\_RATEB  &  &scan\_rateb &508 &8    &scan\_rateb &508 &8    \\
-BYTE\_GRP    &  &byte\_grp   &516 &4    &[RESERVE]   &--- &---  \\
-NBEAM	     &  &nbeam	     &598 &4    &nbeam	     &516 &4    \\
-IBEAM	     &* &ibeam	     &520 &4    &ibeam	     &520 &4    \\
-PSRNAME	     &* &psrname     &524 &12   &pname	     &524 &16   \\
-DATA\_TWO    &  &data2	     &536 &4    &[RESERVE]   &--- &---  \\
-OBS\_FILEN   &  &obs\_filen  &540 &16   &obs\_filen  &540 &16   \\
-NBITS	     &* &nbits	     &556 &2x2  &nbits	     &556 &2x2  \\
-DDM	     &  &ddm	     &560 &8    &ddm	     &560 &8    \\
-NDDCH	     &  &nddch	     &568 &2x4  &nddch	     &568 &2x4  \\
-MOVE	     &* &move	     &576 &2    &move	     &576 &2    \\
-PNTERR	     &  &pnterr	     &578 &6    &pnterr      &578 &6    \\
-TREE	     &  &tree	     &584 &2    &tree	     &584 &2    \\
-NSYS	     &  &nsys	     &586 &2    &nsys	     &586 &2    \\
-TELID	     &* &telid	     &588 &10   &telid	     &588 &10   \\
-PANGLE	     &* &[RESERVE]   &--- &---  &pangle      &598 &8    \\
-SMP\_BSW     &  &[RESERVE]   &--- &---  &smp\_bsw    &606 &8    \\
-CAL\_CYCLE   &  &[RESERVE]   &--- &---  &cal\_cycle  &614 &4    \\
-RESERVE      &  &reserve     &602 &38   &reserve     &618 &22   
-\end{tabular}
-}
-
-\section{How keywords are defined.}
-
-In this section we summarise the keywords and other header parameters
-that go into the PSRFITS file, together with their comment field, and
-detail how the value is arrived at. The value will be generated by:
-\begin{itemize}
-\item Some fixed value that is a constant for the particular survey --
-  either a numeric value or a string.
-\item A direct substitution of the existing file's header values
-(written as \eg \verb|<NFILTER>|, using the enumeration setup detailed
-in the previous setction)
-\item A value calculated from one or more header values via some
-  formula. 
-\end{itemize}
-
-In the case of the first option, we sometimes separate according to
-the survey under consideration -- the options for each survey are then
-listed separately.
-
-The keywords are divided according to the extension, where we show the
-PHU and the \subint extensions. We also show new keywords that are
-added to the PHU, that involve information not in the PSRFITS
-definition that will be useful for VO purposes. These are added using
-the \texttt{PSRFits::addNewKeywords()} function.
-
-For the \subint table, we give the column values that are set for each
-block -- the ``Column Title'' is the \texttt{TTFORM\#} parameter in
-the header. Where the columns are multi-valued, we show how the $i$th
-value is calculated.
-
-\subsection{Existing PHU keywords}
-
-\begin{tabular}{|l|>{\setlength{\rightskip}{0pt plus 2cm}}p{7cm}|>{\setlength{\rightskip}{0pt plus 2cm}}p{5cm}|}\hline
-FITS Keyword & Comment field from FITS header & Value \\ \hline\hline
-
-DATE     & File creation date (\mbox{YYYY-MM-DDThh:mm:ss} UTC) & Date of file creation, from \texttt{fits\_get\_system\_time()}.\\\hline
-
-OBSERVER & Observer name(s)                         & \textbf{not set}\\ \hline
-
-PROJID   & Project name                             & Survey-specific project name.\\ \hline
-
-TELESCOP & Telescope name                           & \verb|<TELID>|\\\hline
-
-ANT\_X    & [m] Antenna ITRF X-coordinate (D)       & -4554231.5 \\\hline
-
-ANT\_Y    & [m] Antenna ITRF Y-coordinate (D)       & 2816759.1 \\\hline
-
-ANT\_Z    & [m] Antenna ITRF Z-coordinate (D)       & -3454036.3 \\\hline
-
-FRONTEND & Rx and feed ID                           & \emph{S70}: ``70cm\_Cavity\_Disk'', \emph{PM/PH}: ``20cm\_MB''\\\hline
-
-FD\_POLN  & LIN or CIRC                             & ``LIN'' \\\hline
-
-FD\_HAND  & +/- 1. +1 is LIN:A=X,B=Y, CIRC:A=L,B=R (I) &  \emph{S70}: 0, \emph{PM/PH}: $+1$\\\hline
-
-FD\_SANG  & [deg] FA of E vect for equal sig in A\&B (E) &  \emph{S70}: 0, \emph{PM/PH}: $-90$\\\hline
-
-FD\_XYPH  & [deg] Phase of A\^* B for injected cal (E) &  \emph{S70}: 0, \emph{PM/PH}: 0\\\hline
-
-BACKEND  & Backend ID                               & ``FB\_1BIT''\\ \hline
-
-BECONFIG & Backend configuration file name          & ``'' \\ \hline
-
-BE\_PHASE & 0/+1/-1 BE cross-phase:0 unknown,+/-1 std/rev & 0 \\\hline
-
-BE\_DCC   & 0/1 BE downconversion conjugation corrected & 0 \\\hline
-
-TCYCLE   & [s] On-line cycle time (D)               & 0 \\\hline
-
-NRCVR    & Number of receiver channels (I)          & \verb|<NFILTER>|\\\hline
-
-OBS\_MODE & (PSR, CAL, SEARCH)                      & ``SEARCH'' \\\hline
-
-SRC\_NAME & Source or scan ID                       & \verb|<PSRNAME>| (Note that this will be blank for survey data!)\\\hline
-
-COORD\_MD & Coordinate mode (J2000, Gal, Ecliptic, etc.)& \verb|<COORD_TYPE>|, translated into text.\\ \hline
-
-STT\_CRD1 & Start coord 1 (hh:mm:ss.sss or ddd.ddd) & \verb|<RA>|\\\hline
-
-STT\_CRD2 & Start coord 2 (-dd:mm:ss.sss or -dd.ddd)& \verb|<DEC>|\\\hline
-
-TRK\_MODE & Track mode (TRACK, SCANGC, SCANLAT)     & ``TRACK'' \\\hline
-
-STP\_CRD1 & Stop coord 1 (hh:mm:ss.sss or ddd.ddd)  & \verb|<RA>|\\\hline
-
-STP\_CRD2 & Stop coord 2 (-dd:mm:ss.sss or -dd.ddd) & \verb|<DEC>|\\\hline
-
-SCANLEN  & [s] Requested scan length (E)            & \emph{S70}: 152, \emph{PM}: 2100, \emph{PH}: 265 \\ \hline
-
-FD\_MODE  & Feed track mode - FA, CPA, SPA, TPA     & \emph{S70}: ``FIXED'', \emph{PM/PH}: ``CPA'' \\ \hline
-
-FA\_REQ   & [deg] Feed/Posn angle requested (E)     & \emph{S70}: 0, \emph{PM/PH}: 30 \\ \hline
-
-CAL\_MODE & Cal mode (OFF, SYNC, EXT1, EXT2)        & ``OFF'' \\ \hline
-
-CAL\_FREQ & [Hz] Cal modulation frequency (E)       &  0 \\\hline
-
-CAL\_DCYC & Cal duty cycle (E)                      & 0 \\\hline
-
-CAL\_PHS & Cal phase (wrt start time) (E)           & 0 \\\hline
-
-STT\_DATE & Start UT date (YYYY-MM-DD)              & \verb|<DATE>|, with the century added on to the start, and '/' changed to '-' \\\hline
-
-STT\_TIME & Start UT (hh:mm:ss)                     & \verb|<UT>|\\ \hline
-
-STT\_IMJD & Start MJD (UTC days) (J - long integer) & \verb|<MJD>|\\ \hline
-
-STT\_SMJD & [s] Start time (sec past UTC 00h) (J)   & \verb|<UT>| as a decimal $\times$ 3600.\\ \hline
-
-STT\_OFFS & [s] Start time offset (D)               & 0 \textbf{NEED TO CHECK THIS.}\\ \hline
-
-STT\_LST  & [s] Start LST (D)                       & \verb|<LST>| as a decimal $\times$ 3600.\\ \hline
-\end{tabular}
-
-\subsection{New PHU keywords}
-
-\begin{tabular}%
-{|l|>{\setlength{\rightskip}{0pt plus 2cm}}p{7cm}|>{\setlength{\rightskip}{0pt plus 2cm}}p{5cm}|}\hline
-FITS Keyword & Comment field from FITS header & Value \\ \hline\hline
-
-OBSFREQ  & [MHz] Observing frequency 
-& \verb|<FREQ_CHAN1>| $+$ ((\verb|<NCHAN>|$-1)/2) \times$
-\verb|<CHANBW>| \\ \hline
-
-RA       & Right Ascension & \verb|<RA>| \\ \hline
-
-DEC      & Declination     & \verb|<DEC>| \\ \hline
-
-DATE-OBS & Date of observation (\mbox{YY-MM-DDThh:mm:ss UTC})  &\verb|<DATE>|, with the century added on to the start, and '/'  changed to '-' \\\hline
-
-EQUINOX  & Equinox         & Either ``1950.0'' or ``2000.0'', if \verb|<COORD_TYPE>| is of one of
-these. \\ \hline
-
-BMAJ     &                 &\emph{S70}: 0.75, \emph{PM/PH}: 0.24 \\ \hline
-
-BMIN     &                 &\emph{S70}: 0.75, \emph{PM/PH}: 0.24 \\ \hline
-
-BPA      &                 &\emph{S70}: 0., \emph{PM/PH}: 0. \\ \hline
-\end{tabular}
-
-
-
-\subsection{SUBINT keywords}
-
-
-\begin{tabular}%
-{|l|>{\setlength{\rightskip}{0pt plus 2cm}}p{7cm}|>{\setlength{\rightskip}{0pt plus 2cm}}p{5cm}|}\hline
-FITS Keyword & Comment field from FITS header & Value \\ \hline\hline
-
-INT\_TYPE & Time axis (TIME, BINPHSPERI, BINLNGASC, etc)   & ``TIME'' \\\hline
-
-INT\_UNIT & Unit of time axis (SEC, PHS (0-1), DEG)        & ``SEC'' \\ \hline
-
-TSAMP     & [s] Sample interval for SEARCH-mode data       & \verb|<SAMP_INT>| $\times$ 1000. \\ \hline
-
-NBIN      & Nr of bins (1 for SEARCH-mode data)            & 1 \\ \hline
-
-NCH\_FILE & Number of channels/sub-bands in this file      & \verb|<NCHAN>| \\ \hline
-
-NCH\_STRT & Start channel/sub-band number (0 to NCHAN-1)   & 0 \\ \hline
-
-NPOL      & Nr of polarisations in table                   & 1 \\ \hline
-
-NSBLK     & Samples/row (each NPOL*NCH\_FILE, SEARCH mode) & \verb|<SAMP_GRP>| $\times$ \verb|<GRP_BLK>| \\ 
-\hline
-\end{tabular}
-
-\subsection{SUBINT columns}
-
-\begin{tabular}%
-{|l|>{\setlength{\rightskip}{0pt plus 2cm}}p{7cm}|>{\setlength{\rightskip}{0pt plus 2cm}}p{5cm}|}\hline
-Column title & Comment field from FITS header & Value \\ 
-\hline\hline
-
-ISUBINT  & Subint number
-& Incremental counter of the number of rows.\\ \hline
-TSUBINT  & Length of subintegration                         & \verb|<BLK_SEC>| \\ \hline
-
-OFFS\_SUB & Offset from Start of subint centre              &$\frac{1}{2}\times(2\times(\verb|<BLK_CNTR>|-(\verb|blk_initial|))+1)\times \verb|<BLK_SEC>|$ \\ \hline
-
-LST\_SUB  & LST at subint centre                            & \verb|<LST>| \\ \hline
-
-RA\_SUB   & RA (J2000) at subint centre                     & \verb|<RA>| \\ \hline
-
-DEC\_SUB  & [turns] Dec (J2000) at subint centre            & \verb|<DEC>| \\ \hline
-
-GLON\_SUB & [deg] Gal longitude at subint centre            & \verb|<GL>| \\ \hline
-
-GLAT\_SUB & [deg] Gal latitude at subint centre             & \verb|<GB>| \\ \hline
-
-FD\_ANG   & [deg] Feed angle at subint centre               & \verb|<FEED_ANGLE>| \\ \hline
-
-POS\_ANG  & [deg] Position angle of feed at subint centre   & \verb|<PANGLE>| \\ \hline
-
-PAR\_ANG  & [deg] Parallactic angle at subint centre        & $(\verb|<FEED_ANGLE>| + \verb|<PANGLE>|) \bmod 360$ \\ \hline
-
-TEL\_AZ   & [deg] Telescope azimuth at subint centre        & \verb|<TEL_AZ>| \\ \hline
-
-TEL\_ZEN  & [deg] Telescope zenith angle at subint centre   & \verb|<TEL_ZEN>| \\ \hline
-
-DAT\_FREQ & [MHz] Centre frequency for each channel         & $\verb|<FREQ_CHAN1>| + i\times\verb|<CHANBW>|$ \\ \hline
-
-DAT\_WTS  & Weights for each channel                        & 1 $\forall i \in\left[1,\verb|<NCHAN>|\right]$ \\ \hline
-
-DAT\_OFFS & Data offset for each channel                    & 0 $\forall i \in\left[1,\verb|<NCHAN>|\right]$ \\ \hline
-
-DAT\_SCL  & Data scale factor for each channel              & 1 $\forall i \in\left[1,\verb|<NCHAN>|\right]$ \\ \hline
-\end{tabular}
-
-\newpage
-\section{Details of Implementation of Header analysis}
-
-We list here some important details about how the header information
-will be implemented in the code:
-
-\begin{itemize}
-\item There will be an enum structure that enumerates the keywords
-  given in the first column of the preceeding table. These will be
-  used to refer to the relevant header keyword throughout the code.
-\item There will be arrays of starting position and length of
-  field. These will need to be implemented differently for each
-  survey, due to the different starting positions for some keywords
-  (although most are the same, some that we will need are either in
-  different positions or not present in one or other of the
-  setups). The different implementations can be done through a single
-  function call within a class (with a switch to the necessary setup,
-  depending on the argument of the function).
-\item Some fields include more than one value, and so there will need
-  to be an array recording the dimension of each field (\eg NCHAN,
-  giving the number of channels, is 2$\times$4 characters in size, 
-\item There will be a standard function (templated to cope with int,
-  float and string variables) that extracts the relevant substring and
-  reads the value in that string. It will also need an argument
-  indicating the element required, if the keyword has more than one
-  dimension (this should be an optional parameter). \eg:
-  \begin{verbatim}
-    string utStartTime = readParameter(headerString, UT_STRT, 0);
-    float ra = readParameter(headerString, RA);
-    int bandwidth2 = readParameter(headerString, CHANBW, 1);
-  \end{verbatim}
-\item Enumerated keywords that are not present for a given survey
-  should point to the RESERVE location, and be given a length of
-  0. This provides a good test as to whether something is present
-  (\eg testing to see if the fdcntrl parameter is present, as it will
-  only be in the PM survey data).
-\end{itemize}
-
-The class that we have designed to implement this scheme is as follows:
-{\small
-\begin{verbatim}
-  class SurveySchema
-  {
-  public:
-    SurveySchema(){};
-    SurveySchema(std::string surveyName);
-    virtual ~SurveySchema(){};
-    int getStartPosition(int field){return startPosition[field];};
-    int getFieldLength(int field){return fieldLength[field];};
-    int getFieldDimension(int field){return fieldDimension[field];};
-    template <class T> T readParameter(std::string headerString, int field,
-				       int elementNumber = 0);
-    class xBadSurvey{
-    public:
-      xBadSurvey(std::string s){surveyName=s;};
-      virtual ~xBadSurvey(){};
-      std::string getSurvey(){return surveyName;};
-    private:
-      std::string surveyName;
-    };
- 
-  private:
-    int startPosition[numKeywords];
-    int fieldLength[numKeywords];
-    int fieldDimension[numKeywords];
-  };
-
-\end{verbatim}
-}
-
-\newpage
-\section{Implementation of existing data file}
-
-The fundamental unit of data from the existing files is going to be
-the \emph{block}. This is the 640-character-long header string, plus
-the 48-kbyte data array. It will have the following elements:
-
-\begin{itemize}
-\item A string indicating which survey type it belongs to
-\item A header string -- the 640-character long string with all the
-  header information in it.
-\item A SurveyHeader object, which has the encoding of the header
-  string recorded, and provides the functionality to extract keywords
-  from the header string.
-\item A data array, stored as characters (?).
-\item A function that acts as a front-end to the readParameter
-  function in the header class above.
-\end{itemize}
-
-\newpage
-\section{Implementation of FITS file access}
-
-The FITS file will be accessed through a special C++ Class that has
-functions that will control the writing of data to the PHU and to the
-SUBINT binary table. These functions will be front-ends to the
-updateKeyword and writeColumnValue functions that access the
-individual keywords and table columns.
-
-\subsection{Positional information}
-
-WARNING! Contrary to first thought, the existing header parameters
-\textsc{ra\_strt} and \textsc{dec\_strt} are not the appropriate ones
-for the \textsc{stt\_crd1,2} FITS keywords. They are the starting
-positions \emph{as far as the file is concerned}, and so are the same
-even when the telescope has moved to a different position. They are
-not the position of the start of the subints for a given sky location! 
-
-\subsection{Storing 1-bit binary data}
-
-As discussed earlier (Section~\ref{sec-1bit1st}), there are a couple of
-ways to write 1-bit data to a binary table using \cfitsio. However, we
-have run up against several problems. 
-
-First, the \texttt{TFORMn} keyword that goes with the data column
-needs to be `X', but the PSRFITS definition file currently has it as
-`I'. This is not a problem -- in fact, one probably does not want the
-general definition file to be 1-bit by default. It can easily be
-changed to `X' by the \verb|fits_update_key| function. 
-
-However, a word of caution. The implicit size of the row needs to be
-preserved, and so since the `I' datatype is 2-bytes, we need to
-replace `I' by `16X' (since there are 16 bits in 2 bytes). This is
-incorporated into a \texttt{fixPSRFITS} function in the PSRFits class.
-
-Next, however, there is a bug in \cfitsio that incorrectly calculates
-the number of bytes for a given number of bits when the `X' datatype
-is being used. This bug is in \texttt{editcol.c} in the \cfitsio
-distribution and is easily fixed:
-\begin{quote}
-delbyte = ((newveclen + 1) / 8) - ((repeat + 1) / 8);
-\end{quote}
-should be replaced by
-\begin{quote}
-delbyte = ((newveclen + 7) / 8) - ((repeat + 7) / 8);
-\end{quote}
-
-Another bug/feature to be wary of: when writing the first block to a
-FITS file, it seems to want to write a second row with nothing in
-it. This doesn't happen for any subsequent rows/blocks, so I'm not
-really sure what is happening. It is easy to delete that extra row on
-the first time round (for the first block, we also need to redefine
-the data cell's dimensions and size, so this can be done in the same
-way). 
-
-
-\end{document}
-% LocalWords:  cfitsio
Index: unk/docs/questions_and_problems_pulsarVO.tex
===================================================================
--- /trunk/docs/questions_and_problems_pulsarVO.tex	(revision 486)
+++ 	(revision )
@@ -1,163 +1,0 @@
-\documentclass{article}
-\usepackage{natbib}
-\usepackage{fancyheadings}
-
-\textwidth=165 mm
-\textheight=248 mm
-\topmargin=-15 mm
-\oddsidemargin=0 mm
-\parindent=6 mm
-
-\pagestyle{fancy}
-\rhead{}
-\lhead{}
-\lfoot{\today}
-\cfoot{}
-\rfoot{\thepage}
-\setlength{\headrulewidth}{0in}
-
-\newcommand{\eg}{e.g.\ }
-\newcommand{\ie}{i.e.\ }
-\newcommand{\fdg}{\hbox{$.\!\!^\circ$}}
-\newcommand{\cfitsio}{\textsc{cfitsio}}
-\newcommand{\subint}{\textsc{subint}}
-
-\begin{document}
-\begin{flushright}
-{\huge Questions and Problems for Pulsar VO}\\
-\vspace{5mm}{\Large Matthew Whiting}
-\end{flushright}
-
-\section{Unresolved questions}
-Questions that need to be asked about the equivalence between keywords
-in the old and new formats, and also which keywords we need to use in
-the PSRFITS format. Some of these decisions are basically ``policy''
-ones, about how we want the data to be stored and with what
-information. 
-\begin{itemize}
-\item If a given sky position is covered by more than one existing
-  file, there will probably be gaps in the time sequence. Do we want
-  all these separate blocks in the one file? Do we want separate FITS
-  files for subsequent observations of a given position?
-\item There might be a problem with the time information, at least in
-  the S70 data -- there are successive blocks with \emph{the same} LST
-  and UT time. It seems that the time information is only sampled
-  every second, so with 0.46~sec long subintegrations, you get about 2
-  per second. This makes it impossible to distinguish successive rows
-  in the \subint\ table, save with the block counter.
-\item What positions are we going to give in the Primary Header
-  (Primary HDU) -- RA/Dec or GL/GB?
-\item How are the output fits files to be named? I am currently basing
-  the name on the Equatorial position, \eg J121424m445100.fits. Would
-  any other scheme be preferable?
-\item Re the order of the axes in the \subint\ data entry: the PSRFITS
-  definition has (NBIN,NCH\_FILE,NPOL) in the comments, but the FITS
-  standard requires them to be ordered from fastest-varying to
-  slowest-varying index -- this means it should be
-  (NCH\_FILE,NPOL,NBIN).
-\item How does \texttt{nfilter} (old format) compare to \texttt{NPOL}
-  (in the \subint\ table -- dimensions of the data format). (NB: this
-  is a minor issue, as they are both 1 for all cases to do with this
-  project -- this is a more general question though about how the
-  PSRFITS setup is motivated).
-\item What are the correct values for the standard keywords in the
-  Primary HDU (the ones such as \textsc{frontend} that will not change
-  across the entire survey)? Are these necessary?
-\item What do we put for \textsc{projid} for each survey? (\ie how do
-  we want the survey names recorded?)
-\item Do we use ``TRACK'' or ``SCANGC''/''SCANLAT'' for the value of
-  the Primary HDU keyword \textsc{trk\_mode}?
-\item The \subint\ column \textsc{posang} -- is this defined anywhere?
-  Should this be the \texttt{feed\_angle} parameter in the existing
-  headers? 
-\item A check is needed on the definition of \textsc{offs\_sub} : I
-  understand it to be the time from the start of the file (as given by
-  the Primary HDU keyword \textsc{ut}) to the centre of the current
-  subintegration (\ie the centre of the block stored in the data entry
-  of the current row of the \subint\ table). Is this correct?
-\item Currently the only extensions being written to are the Primary
-  HDU and the \subint\ table. Do we need to add information into any
-  other extensions? The only possibility could be the \textsc{history}
-  table, but this seems to be the \emph{processing} history, so may
-  not be applicable.
-\item How do we get the position of a given beam in the multibeam
-  case? Presumably the position stored in the header will be the
-  central position, so we need to convert using the beam number and
-  the position/feed angle. 
-\item Is there a difference between the PM survey data and the PH
-  survey data? Can we tell the difference by looking at the first few
-  bytes (as we do for S70 data files)? Are we in fact going to deal
-  with PH data? (This was mentioned in the project plan.)
-\item We are currently setting the scale, offsets and weights in the
-  \subint\ table to 1., 0., and 1.\ respectively. Is this OK? We don't
-  seem to have any further information, so hopefully that is fine.
-\end{itemize}
-
-\newpage
-\section{PSRFITS definition: additions and problems}
-
-\subsection{New FITS keywords and changes needed}
-
-We detail here any new keywords that need to be added to the primary
-HDU of the PSRFITS file. These are for information that is either not
-present at all in the FITS file, or information that is stored in one
-of the extensions, but would be worth having in the primary HDU for
-easy examination.
-
-\begin{itemize}
-\item \texttt{BEAMSIZE} (suggested name) -- the size of the beam, so
-  that a reader knows how much area of sky the FITS file covers. It
-  may be better to use the SDFITS standard of \texttt{BMAJ, BMIN \&
-  BPA}. 
-\item \texttt{OBSFREQ} (or similar) -- the central frequency of the
-  observation. This is stored in some of the binary tables
-  (\textsc{history, subint, ...}), but it would be useful to have this
-  upfront as well so the user doesn't have to drill down into the
-  tables. 
-
-  I presume it is not in the PSRFITS definition as the observing
-  frequency could conceivably change (and be recorded in the \subint\
-  table), but for \emph{this} case (of a survey done at a particular
-  frequency) it might be useful to include.
-\item \texttt{DATE-OBS} -- the standard FITS way of presenting the
-  date of the observation.
-\item \texttt{TIMESYS} -- a suggested keyword to indicate the time
-  system being used.
-\item \texttt{EQUINOX} -- this is the FITS standard for presenting
-  the equinox \eg 2000.0.
-\item \texttt{RA,DEC,...} -- positional information in a recognisable
-  format, not just \texttt{STT\_CRD1} etc. This is to make it more
-  accessible for users (\ie more obvious what the position is, and
-  potentially recognisable for other software). (See the note about
-  the \texttt{OBSFREQ} keyword, noting that each FITS file will have
-  just one sky position).
-\item \texttt{UT} -- a new field for the UT might be needed in the
-  \subint\ binary table (there isn't one at the moment). The UT is a
-  quantity that should, conceivably, be useful for users of the
-  data. One could calculate it from the LST and the telescope
-  location, but having it present in the file simplifies the searching
-  possibilities. That said, the \texttt{offs\_sub} field does provide
-  it (via an offset from the \textsc{ut} keyword in the Primary HDU to
-  the \emph{centre} of the current subint).
-\end{itemize}
-
-\subsection{Problems with the definition}
-Additionally, here is a list of problems with the PSRFITS definition
-that might need to be changed at the same time:
-\begin{itemize}
-\item The \texttt{TTFORMn} keyword for the \texttt{DATA} entry in the
-  \subint\ table is set to `I' -- for this project this needs to be
-  changed to `X'. This can be done in the software, but would it be
-  better to change the definition? Of course, not all data will be
-  stored as 1-bit, so it may not be warranted to change the
-  definition. 
-\item \texttt{RA\_SUB} and \texttt{DEC\_SUB} in the \subint\
-  binary table currently have units (in the \texttt{TUNIT} entry) of
-  ``turns'' -- not sure why. This should be changed to ``deg''.
-\item \texttt{DAT\_FREQ} has units of ``deg''. This should go to
-  ``MHz'' (for the S70 data at least -- I have not seen a multibeam
-  data file to know what units the frequency is stored in).
-\end{itemize}
-
-
-\end{document}
Index: unk/docs/questions_and_problems_pulsarVO_v2.tex
===================================================================
--- /trunk/docs/questions_and_problems_pulsarVO_v2.tex	(revision 486)
+++ 	(revision )
@@ -1,305 +1,0 @@
-\documentclass{article}
-\usepackage{natbib}
-\usepackage{fancyheadings}
-\usepackage{color}
-
-\textwidth=165 mm
-\textheight=248 mm
-\topmargin=-15 mm
-\oddsidemargin=0 mm
-\parindent=6 mm
-
-\pagestyle{fancy}
-\rhead{}
-\lhead{}
-\lfoot{\today}
-\cfoot{}
-\rfoot{\thepage}
-\setlength{\headrulewidth}{0in}
-
-\newcommand{\eg}{e.g.\ }
-\newcommand{\ie}{i.e.\ }
-\newcommand{\fdg}{\hbox{$.\!\!^\circ$}}
-\newcommand{\cfitsio}{\textsc{cfitsio}}
-\newcommand{\subint}{\textsc{subint}}
-
-\begin{document}
-\begin{flushright}
-{\huge Questions and Problems for Pulsar VO -- 2nd iteration}\\
-\vspace{5mm}{\Large Matthew Whiting}
-\end{flushright}
-
-{\small Note on style: paragraphs \textcolor{red}{in red starting with
-  $>$} are comments by Dick Manchester on the original text, and those
-  \textcolor{blue}{in blue with $>>$} are my responses. Many of the
-  original points have been deleted, as they have been solved or are
-  no longer relevant.}
-
-\section{Unresolved questions}
-Questions that need to be asked about the equivalence between keywords
-in the old and new formats, and also which keywords we need to use in
-the PSRFITS format. Some of these decisions are basically ``policy''
-ones, about how we want the data to be stored and with what
-information. 
-\begin{itemize}
-
-\item There might be a problem with the time information, at least in
-  the S70 data -- there are successive blocks with \emph{the same} LST
-  and UT time. It seems that the time information is only sampled
-  every second, so with 0.46~sec long subintegrations, you get about 2
-  per second. This makes it impossible to distinguish successive rows
-  in the \subint\ table, save with the block counter.
-\textcolor{red}{
-\\ $>$ The time of each block can be computed exactly from the header
-  data. If you want to do this, I'll give you the details.
-}
-\textcolor{blue}{
-\\ $>>$ I think I've worked this out. The offset is just the number of
-  blocks times the length of time for each block, which is available in
-  the header. The only question is whether the value of the start time
-  is accurate enough.
-}
-
-\item Re the order of the axes in the \subint\ data entry: the PSRFITS
-  definition has (NBIN,NCH\_FILE,NPOL) in the comments, but the FITS
-  standard requires them to be ordered from fastest-varying to
-  slowest-varying index -- this means it should be
-  (NCH\_FILE,NPOL,NBIN).
-\textcolor{red}{
-\\ $>$ I think it's debatable which varies fastest. You can think of a
-  spectrum for each poln and bin or a profile for each channel and poln,
-  which is the way we think of it and the analysis software expects
-  it. I am reluctant to change this. 
-}
-\textcolor{blue}{
-\\ $>>$ The ``varies fastest'' refers to the changing of values in the
-  data array. This means you can take the array of measurements and
-  write it as a 3-dimensional cube. For instance, if the following 2D
-  array 
-  \begin{tabular}{lll}
-    1  &2  &1 \\
-    1  &3  &1  \\
-    2  &3  &2  \\
-    1  &2  &1  \\
-  \end{tabular}
-  is stored in this fashion as an array of integers (starting at
-  bottom left) -- (1,2,1,2,3,2,1,3,1,1,2,1) -- then the dimension
-  string should be (3,4), since the X-axis varies fastest. Note that
-  I've set this up so that, when set out as above, there is a clear
-  pattern with the middle element of each row being the largest and
-  the row being symmetric.
-}
-
-\textcolor{blue}{
-  If it was given as (4,3), the same array would instead be
-  transcribed as:
-  \begin{tabular}{llll}
-    1  &1  &2  &1\\
-    3  &2  &1  &3\\
-    1  &2  &1  &2\\
-  \end{tabular}
-  And note that the clear pattern has been destroyed.
-}
-
-\textcolor{blue}{  
-  So in this sense the channel number varies fastest, followed by the
-  polarisation (when present, which isn't the case here), and then the
-  time sampling.
-}
-
-\item How does \texttt{nfilter} (old format) compare to \texttt{NPOL}
-  (in the \subint\ table -- dimensions of the data format). (NB: this
-  is a minor issue, as they are both 1 for all cases to do with this
-  project -- this is a more general question though about how the
-  PSRFITS setup is motivated).
-\textcolor{red}{
-\\ $>$ nfilter is the number of filter bands simultaneously recorded,
-  either 1 or 2 with present systems. If the scheme above is used, these
-  would be separate files. npol is the number of polarisations, normally
-  1 (for summed orthog polns), 2 for orthog polns or 4 for full Stokes.
-}
-\textcolor{blue}{
-\\ $>>$ That's fine. Is \texttt{nfilter} defined anywhere in the
-  header, or is it set for the entire survey?
-}
-
-\item A check is needed on the definition of \textsc{offs\_sub} : I
-  understand it to be the time from the start of the file (as given by
-  the Primary HDU keyword \textsc{ut}) to the centre of the current
-  subintegration (\ie the centre of the block stored in the data entry
-  of the current row of the \subint\ table). Is this correct?
-\textcolor{red}{
-\\ $>$ I need to check this. I think it might be the time at the start of
-  the subint. The precise start time of the obs is defined by the STT
-  parameters in the main header. 
-}
-\textcolor{blue}{
-\\ $>>$ The current formula for calculating the offset of block $i$ is 
-  $t_{\rm off} = t_{\rm blk} \times (2(i-i_0)+1)/2$, where the data
-  starts at block $i_0$ and each block is of length $t_{\rm blk}$. This,
-  then, is the time offset to the middle of the block. 
-}
-
-\item Currently the only extensions being written to are the Primary
-  HDU and the \subint\ table. Do we need to add information into any
-  other extensions? The only possibility could be the \textsc{history}
-  table, but this seems to be the \emph{processing} history, so may
-  not be applicable.
-\textcolor{red}{
-\\ $>$ I think it would be useful to put the method, date etc of creation
-  of the fits file in the History table.
-}
-\textcolor{blue}{
-\\ $>>$ I have put date and the execution command (\ie command-line
-  statement) in a row in the \textsc{history} table.
-}
-
-\item What are the correct values for the standard keywords in the
-  Primary HDU (the ones such as \textsc{frontend} that will not change
-  across the entire survey)? Are these necessary?
-\textcolor{red}{
-\\ $>$ These should be filled in where possible. For S70,
-  ``70cm\_Cavity\_Disk'', FD\_POLN ``LIN'', Backend ``FB\_1BIT'', OBS\_MODE
-  ``SEARCH'', etc.
-}
-\textcolor{blue}{
-\\ $>>$ OK. We need to make a table for each of these, for each of the
-  surveys. This applies for \sc{projid \& trk\_mode}. See below.
-}
-\end{itemize}
-
-
-\subsection{Unresolved Primary HDU keywords}
-
-The following table lists the Primary HDU keywords that will be
-constant for all observations within a given survey. These should be
-defined as much as possible.
-
-\begin{center}
-%\begin{table}[h]
-\begin{tabular}{l|p{3.5cm}|p{3.5cm}|p{3.5cm}}
-Header keyword & S70         & PM        & PH       \\ \hline
-OBSERVER       &             &           &          \\
-PROJID         &             &           &          \\
-ANT\_X         &             &           &          \\
-ANT\_Y         &             &           &          \\
-ANT\_Z         &             &           &          \\
-FRONTEND       &70cm\_Cavity\_Disk &       &      \\
-FD\_POLN       &LIN          &           &          \\
-FD\_HAND       &             &           &          \\
-FD\_SANG       &             &           &          \\
-FD\_XYPH       &             &           &          \\
-BACKEND        &FB\_1BIT     &           &          \\
-BECONFIG       &             &           &          \\
-BE\_PHASE      &             &           &          \\
-BE\_DCC        &             &           &          \\
-TCYCLE         &             &           &          \\
-OBS\_MODE      & SEARCH      & SEARCH    & SEARCH   \\
-TRK\_MODE      & TRACK       &           &          \\
-SCANLEN        & 152.        & 2100.     & 265.     \\
-FD\_MODE       &             &           &          \\
-FA\_REQ        &             &           &          \\
-CAL\_MODE      & OFF         & OFF       & OFF \\
-CAL\_FREQ      &             &           &          \\
-CAL\_DCYC      &             &           &          \\
-CAL\_PHS       &             &           &          \\
-\end{tabular}
-%\end{table}
-\end{center}
-
-\newpage
-\section{PSRFITS definition: additions and problems}
-
-\subsection{New FITS keywords and changes needed}
-
-We detail here any new keywords that need to be added to the primary
-HDU of the PSRFITS file. These are for information that is either not
-present at all in the FITS file, or information that is stored in one
-of the extensions, but would be worth having in the primary HDU for
-easy examination.
-
-\begin{itemize}
-\item \texttt{BEAMSIZE} (suggested name) -- the size of the beam, so
-  that a reader knows how much area of sky the FITS file covers. It
-  may be better to use the SDFITS standard of \texttt{BMAJ, BMIN \&
-  BPA}. 
-\textcolor{red}{
-\\ $>$ OK. For the PM/PH surveys we could be clever and give the actual
-  beam ellipse - the outer beams are affected by coma distortion. I
-  don't know if anyone has computed them - consult HI people?
-}
-\textcolor{blue}{
-\\ $>>$ Multibeam HI data has keywords BMAJ = BMIN = 0.24 and BPA =
-  0. Assume beam size of 0\fdg75 for the 70-cm receiver (so that BMAJ
-  = BMIN = 0.75). Code to write these new keywords in has been added. 
-}
-\item \texttt{OBSFREQ} (or similar) -- the central frequency of the
-  observation. This is stored in some of the binary tables
-  (\textsc{history, subint, ...}), but it would be useful to have this
-  upfront as well so the user doesn't have to drill down into the
-  tables. 
-\textcolor{red}{\\ $>$ OK}
-\item \texttt{DATE-OBS} -- the standard FITS way of presenting the
-  date of the observation.
-\textcolor{red}{\\ $>$ OK. We currently use Warwick's format.}
-\item \texttt{EQUINOX} -- this is the FITS standard for presenting
-  the equinox \eg 2000.0.
-\textcolor{red}{\\ $>$ OK}
-\item \texttt{RA,DEC,...} -- positional information in a recognisable
-  format, not just \texttt{STT\_CRD1} etc. This is to make it more
-  accessible for users (\ie more obvious what the position is, and
-  potentially recognisable for other software). (See the note about
-  the \texttt{OBSFREQ} keyword, noting that each FITS file will have
-  just one sky position).
-\textcolor{red}{
-\\ $>$ These parameters are used as some survey data was recorded in
-  scanning mode and the position varies smoothly through the file. I
-  don't think any of the data that we are currently looking at use
-  this mode. 
-}
-
-\textcolor{blue}{
-$>>$ To follow up all these points: I have added code that manually
-  adds in keywords for \texttt{OBSFREQ, RA, DEC, DATE-OBS, EQUINOX,
-  BMAJ, BMIN, BPA}. This can be used until they get added to the
-  definition file. 
-}
-
-\item \texttt{TIMESYS} -- a suggested keyword to indicate the time
-  system being used.
-\textcolor{red}{\\ $>$ Do you mean TDB or TCB?}
-\textcolor{blue}{
-\\ $>>$ Actually, not sure what this was about -- this arose from a
-  discussion with Vince, but I'm not sure it is needed anymore.
-}
-\end{itemize}
-
-\subsection{Problems with the definition file}
-Additionally, here is a list of problems with the PSRFITS definition
-that might need to be changed at the same time:
-\begin{itemize}
-\item Some extensions in the PSRFITS definition file have the
-  nrows parameter equal to 1. This means that when the file gets
-  generated, these tables each have a row with default or null values
-  in it. A particular example is the \textsc{history} extension --
-  when the history information is added in, it becomes the second row,
-  below one with ``NULL'' values in it. It would be preferable to
-  remove these dud rows from the definition -- this is done by
-  changing the ``1'' to a ``$\ast$''.
-\item \texttt{RA\_SUB} and \texttt{DEC\_SUB} in the \subint\
-  binary table currently have units (in the \texttt{TUNIT} entry) of
-  ``turns'' -- not sure why. This should be changed to ``deg''.
-\textcolor{red}{
-\\ $>$ I prefer turns, but so long as it is specified, it's OK.
-}
-\textcolor{blue}{
-\\ $>>$ I have just never come across the use of ``turns'' as a
-  unit. I'm happy to leave it in if it is not an error! Does this then
-  mean the numbers in these columns should be between 0 and 1, rather
-  than decimal degrees?
-}
-\end{itemize}
-
-
-\end{document}
-
Index: unk/docs/webUpgrade.tex
===================================================================
--- /trunk/docs/webUpgrade.tex	(revision 486)
+++ 	(revision )
@@ -1,206 +1,0 @@
-\documentclass{article}
-\usepackage[sort]{natbib}
-\usepackage{listings}
-\usepackage{color}
-\bibpunct[,]{(}{)}{;}{a}{}{,}
-\textwidth=161 mm
-\textheight=248 mm
-\topmargin=-13 mm
-\oddsidemargin=0 mm
-\parindent=6 mm
-
-\newcommand{\eg}{e.g.\ }
-\newcommand{\ie}{i.e.\ }
-\newcommand{\fdg}{\hbox{$.\!\!^\circ$}}
-\newcommand{\entrylabel}[1]{\mbox{\textsf{\bf{#1:}}}\hfil}
-\newenvironment{entry}
-{\begin{list}{}%
-{\renewcommand{\makelabel}{\entrylabel}%
-                        \setlength{\labelwidth}{30mm}%
-                        \setlength{\labelsep}{5pt}%
-                        \setlength{\itemsep}{2pt}%
-                        \setlength{\parsep}{2pt}%
-                        \setlength{\leftmargin}{35mm}%
-}%
-}%
-{\end{list}}
-
-\definecolor{blue_code}{rgb}{.8,.8,1}
-\definecolor{todo_color}{rgb}{1,.8,.8}
-
-\begin{document}
-
-\begin{center}
-{\Huge Pulsar Archive}
-\end{center}
-
-\section{Web Interface Structure}
-\subsection{Requirements}
-
-\begin{itemize}
-\item[psrcat]: This is required to obtaint he exact coordinates of a pulsar in order
-            to then perform a cone search centered on that pulsar.
-\item[tempo.cfg]: This is now a requirement for all psrchvie software, so pav/vap won't
-            execute unless TEMPO environment variable points to a directory containing
-            this file.
-\item[pav]: pav is used to plot observations and calibrations.
-\item[psradd]: psradd is used to combine CPSR2 data files into a single file for the observation
-\item[psrsh]: used for scrunching archives.
-\item[tar]: used to combine all the files together for download (gzip not required)
-\end{itemize}
-
-\subsection{Database policy}
-
-\subsubsection{Databases involved}
-There are two separate databases involved with this project. The first is a mysql database
-running on herschel which contains all information about the observations. The second database
-is the opal database running on serapis. This is an Oracle database, we don't write or update
-anything in this database, only examine it to authenticate a user against opal and get a list
-of projects that a user is associated with.
-
-\subsubsection{Deletion of data}
-No code ever executes an sql DELETE operation. Instead all tables have a column
-called deleted and all code will ignore any tuple where this is set to 1. This 
-reduces the possibility of accidental deletion of data or the possibility of
-data being deleted by a hacker performing sql insertions. 
-The sql user that is used to connect to the database by the web interface and
-the DBUpdater program should not have delete privileges. Instead another user
-account should exist, which a system administrator can use to perform deleting
-of records. The operation is simple, "DELETE FROM OBSERVATIONS WHERE DELETED = 1"
-but should only be done by hand on occasions when the number of stale records
-has grown large (in this project this is never expected to be the case).
-
-
-\begin{itemize}
-\item authenticate a user
-\item list the projects that a user is associated with.
-\end{itemize}
-
-\subsection{Configuration}
-The file htdocs2/config.php contains the following constants
-
-\begin{verbatim}
-DB_HOST         - host providing the mysql database containing observation data.
-DB_USER         - username to use when connecting ot the mysql database
-DB_PASSWD       - password for connecting to the mysql database
-DB_NAME         - name of the mysql database containing observation data
-OPAL_USER       - username to use when conencting to the opal database
-OPAL_PASSWD     - password to use when connecting to the opal database
-OPAL_DSN        - DSN of the opal database.
-GREEN_ZONE_DIR  - Location of GreenZone files.
-PSRHOME         - psrhome environment variable
-TEMPO           - tempo environment variable
-FIX_LD_LIB      - String for adding environment variables before commands
-PAV_CMD         - String for calling pav
-PSRCAT_CMD      - String for calling psrcat
-VAP_CMD         - String for calling vap
-PSRADD_CMD      - String for calling psradd
-PSRSH_CMD       - String for calling psrsh
-DATA_DIR        - The directory where psradded,scrunched etc files will be placed
-WEB_ROOT        - The root directory for this site (don't think this is needed anymore)
-DOWNLOAD_DIR    - The directory to place files ready for download
-PLOTS_DIR       - The directory to place plots
-MAX_ROWS        - The maximum number or records to return with each search
-PROP_PERIOD     - The number of days that observations remain proprietary
-DOWNLOAD_LIMIT  - The maximum size of a single download in MB
-\end{verbatim}
-
-\subsection{Directory Layout}
-
-\begin{verbatim}
-Clases
-|---------General
-|---------Astro
-|---------Pulsar
-|---------Model
-|---------Queries
-|---------Interfaces
-Forms
-templates
-\end{verbatim}
-
-The Forms directory contains the php code for each page, the templates directory contains the
-smarty templates for each page. 
-
-All forms have the same basic functionality which they inherit from GZBaseForm and override as necessary
-\begin{verbatim}
-ReadForm()       - Read in any input data from SESSION, GET and POST (excluding PostActions)
-ProcessActions() - Examine PostAction data perform operations selected by the user
-Display()        - Present the form in its current state
-\end{verbatim}
-
-Much of the functionality of the site exists in the directories under Classes.
-\begin{itemize}
-\item[General/File] Simple class representing a file, can also tell you if a file exists, if its a directory etc.
-\item[General/Dir] Simple class representing a directory, can create etc
-\item[General/TarBuilder] An algorithm class for creating tar archives. Specify the target file, source directory and filenames
-                          and it builds the file.
-\item[General/Date] A class representing a date, can be converted between some formats.
-\item[General/UserData] A class representing a user of the system, ie their email address, the method they used to login on and
-                        any projects they are associated with.
-\item[Astro/Angle] This class represents an angle, it can be specified in degrees or radians and converted between the two,
-                   it can also be read from and written to several formats, ie HMS,DMS etc.
-\item[Astro/Band] This represents a frequency band, for this project we have (70cm,50cm,20/18cm...)
-\item[Astro/MJD] A class representing an MJD, can be converted to/from a Date/string.
-\item[Astro/SkyCoord] Two angles representing a sky coordinate 
-\item[Pulsar/ArchiveScruncher] Give this class a source file, destination file and scrunching parameters and it will create
-                               a new archive scrunched accordingly, uses psrsh to do the dirty work.
-\item[Pulsar/CPSR2Combiner] Give this class a destination file and archives to add and it will combine them into a single archive
-                               uses psradd to do the work.
-\item[Pulsar/PulsarCatalog] Give this class the name of a pulsar and it will give you the coordinates. Uses psrcat to do the work.
-\item[Pulsar/ObservationData2] This class does all the work of managing the various data files in the pipeline from the source
-                               file to a file that can be plotted, to a file scrunched, to a file ready for download.
-\item[Model/ObservationHeader] This class represents the details of an observation, basically equivelant to a record in the
-                               observations table
-\item[Model/ObservationSet]    This class represents an observation and all the calibrations that were found to be within X minutes
-                               of it. A list of ObservationSet objects is the fundamental data structure used in the web code, they 
-                               form the result from a query, the contents of the cart and the data given to the table for display.
-\item[Model/ObservationSetFinder] Give this class the parameters from the query from, the database object and it will return a list
-                                  of observation sets matching that query.
-\item[Queries/ConeQuery] The basic cone query, it takes ConeQueryParameters and returns the ObservationHeaders it gets from the
-                         database. This class is used by conesearch.php (VO search) as well as the main site.
-\end{itemize}
-
-
-\section{Database Updater program}
-
-\subsection{Requirements}
-This program compiles against psrchive, and requires a properly setup psrhome including
-tempo configuration files in order to function (as of current release of psrchive, this
-may not be a requirement in future).
-
-\subsubsection{Specific requirements}
-\begin{itemize}
-\item libsofa
-\item libcfitsio
-\item psrchive (see below for build requirements)
-\item tempo installation files
-\end{itemize}
-
-\subsubsection{Psrchive requirements}
-\begin{itemize}
-\item psrchive won't build without the following
-\item libsofa
-\item libfftw or a compatible floating point fft library
-\end{itemize}
-
-\subsection{Compiling}
-
-The only parameters you need to specify are, PSRHOME and PACKAGES in the Makefile
-file. However, all the packages listed in the requirements above must be present
-either under these two directories, or the system path.
-
-\subsection{Operation}
-To run DBUpdater, simply specify the directories you want to search on the command line
-
-\lstset{backgroundcolor=\color{blue_code}}
-\begin{lstlisting}
-DBUpdater /pulsar/archive09/ /pulsar/archive10/
-\end{lstlisting}
-
-The program will only mark observations as deleted if they are under the directory
-tree being examined by DBUpdater during that run.
-
-
-
-\end{document}
Index: unk/find_suffix_types.sh
===================================================================
--- /trunk/find_suffix_types.sh	(revision 486)
+++ 	(revision )
@@ -1,17 +1,0 @@
-#!/bin/sh
-
-echo "DFB data suffixes:"
-find $DFB1 $DFB2 -name "*.*b" -printf "%f\n" | awk '{gsub("[0-9_:-]+","*"); print $1}' | sort | uniq
-find $DFB1 $DFB2 -name "*.?r" -printf "%f\n" | awk '{gsub("[0-9_:-]+","*"); print $1}' | sort | uniq
-find $DFB1 $DFB2 -name "*.?f" -printf "%f\n" | awk '{gsub("[0-9_:-]+","*"); print $1}' | sort | uniq
-echo " "
-echo "WBC data suffixes:"
-find $WBC $WBC2 -name "*.*b" -printf "%f\n" | awk '{gsub("[0-9_:-]+","*"); print $1}' | sort | uniq
-find $WBC $WBC2 -name "*.?r" -printf "%f\n" | awk '{gsub("[0-9_:-]+","*"); print $1}' | sort | uniq
-find $WBC $WBC2 -name "*.?f" -printf "%f\n" | awk '{gsub("[0-9_:-]+","*"); print $1}' | sort | uniq
-echo " "
-echo "CPSR data suffixes:"
-find $CP1 $CP2 -name "*.*b" -printf "%f\n" | awk '{gsub("[0-9_:-]+","*"); print $1}' | sort | uniq
-find $CP1 $CP2 -name "*.?r" -printf "%f\n" | awk '{gsub("[0-9_:-]+","*"); print $1}' | sort | uniq
-find $CP1 $CP2 -name "*.?f" -printf "%f\n" | awk '{gsub("[0-9_:-]+","*"); print $1}' | sort | uniq
-echo " "
Index: unk/install_to_psr.sh
===================================================================
--- /trunk/install_to_psr.sh	(revision 486)
+++ 	(revision )
@@ -1,25 +1,0 @@
-#!/bin/tcsh 
-#
-# A script to install the files etc into the correct directory,
-# changing their suffixes so that it matches the PSR standards (ie. as
-# expected by the makefiles and so on).
-
-set PSRDEST="/pulsar/psr/pvo"
-
-echo Copying to $PSRDEST
-
-rm -rf $PSRDEST/Makefile $PSRDEST/*.C $PSRDEST/*.hh
-
-cp Makefile.psr           $PSRDEST/Makefile
-cp src/pvoconvert.cc      $PSRDEST/pvoconvert.C
-cp src/pvosummary.cc      $PSRDEST/pvosummary.C
-cp src/pvotapesummary.cc  $PSRDEST/pvotapesummary.C
-cp src/pvoconesearch.cc   $PSRDEST/pvoconesearch.C
-cp src/pvofixfilename.cc  $PSRDEST/pvofixfilename.C
-cp src/pvo-header.cc      $PSRDEST/pvo-header.C
-cp src/pvo-block.cc       $PSRDEST/pvo-block.C
-cp src/pvo-FITS.cc        $PSRDEST/pvo-FITS.C
-cp src/pvo-FITS-fileIO.cc $PSRDEST/pvo-FITS-fileIO.C
-cp src/pvo-utils.cc       $PSRDEST/pvo-utils.C
-cp src/pvo-metadata.cc    $PSRDEST/pvo-metadata.C
-cp src/*.hh               $PSRDEST
Index: unk/make_s70v_summary_table.csh
===================================================================
--- /trunk/make_s70v_summary_table.csh	(revision 486)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#!/bin/tcsh
-
-set cwd=`pwd`
-cd $S70V
-
-pvosummary -c $S70V/S70V/summary_S70.csv
-
-cd $cwd
Index: unk/set_php_files.sh
===================================================================
--- /trunk/set_php_files.sh	(revision 486)
+++ 	(revision )
@@ -1,23 +1,0 @@
-#!/bin/tcsh 
-#
-# A script to install the files etc into the correct directory,
-# changing their suffixes so that it matches the PSR standards (ie. as
-# expected by the makefiles and so on).
-
-set HOST=herschel.atnf.csiro.au:
-
-set PHPDEST=/var/www/vhosts/pulsararchive.atnf.csiro.au/htdocs
-
-set MYDIR=test/whi550
-
-#set LOCALDIR=$PVO/new-htdocs
-
-#ssh $HOST -x cp -f $LOCALDIR/*.php $PHPDEST/$MYDIR
-#scp -rp $LOCALDIR/*.php $HOST$PHPDEST/$MYDIR
-#scp -rp $LOCALDIR/new/*.php $HOST$PHPDEST/$MYDIR/new
-
-set LOCALDIR=$PVO/htdocs
-scp $LOCALDIR/*php $HOST$PHPDEST
-scp $LOCALDIR/*html $HOST$PHPDEST
-scp -r $LOCALDIR/scripts $HOST$PHPDEST
-scp -r $LOCALDIR/styles $HOST$PHPDEST
Index: /trunk/src/Block.cc
===================================================================
--- /trunk/src/Block.cc	(revision 1)
+++ /trunk/src/Block.cc	(revision 1)
@@ -0,0 +1,130 @@
+#include "Header.hh"
+#include "Block.hh"
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <vector>
+
+using std::string;
+using namespace Header;
+ 
+namespace Block
+{
+
+//   DataBlock::DataBlock(string survey)
+  DataBlock::DataBlock(SURVEY surveyType)
+  {
+    headerString = string(" ",headerLength);
+    Header::SurveySchema *temp = new Header::SurveySchema(surveyType);
+//     Header::SurveySchema *temp = new Header::SurveySchema(survey);
+    this->survey = *temp;
+    this->data = new char[dataLength];
+//     this->surveyName = survey;
+    delete temp;
+  }
+  //--------------------------------------------------------------------------
+
+  DataBlock::~DataBlock()
+  {
+    delete [] data;
+  }
+  //--------------------------------------------------------------------------
+
+  bool DataBlock::readBlock(std::ifstream &file)
+  {
+    if(!this->readHeader(file)) return false;
+    this->readData(file);
+    return true;
+  }
+  //--------------------------------------------------------------------------
+
+  bool DataBlock::readHeader(std::ifstream &file)
+  {
+    char *hdr = new char[headerLength];
+    file.read( hdr, headerLength*sizeof(char) );
+    if(file.eof()) return false;
+    for(int c=0;c<headerLength;c++) this->headerString[c] = hdr[c];
+    return true;
+  }
+  //--------------------------------------------------------------------------
+
+  void DataBlock::readData(std::ifstream &file)
+  {
+    file.read( data, dataLength*sizeof(char) );
+  }
+  //--------------------------------------------------------------------------
+
+//   template <typename Type> 
+//   Type DataBlock::getKeyword(int field, int element)
+//   {
+//     Type output = 
+//       this->survey.readParameter<Type>(this->headerString,field,element);
+//     return output;
+//   }
+//   template int DataBlock::getKeyword<int>(int field, int element);
+//   template float DataBlock::getKeyword<float>(int field, int element);
+//   template string DataBlock::getKeyword<string>(int field, int element);
+  //--------------------------------------------------------------------------
+
+  template <class T> 
+  T DataBlock::getKeyword(int field, int element)
+  {
+    int dim = this->survey.getFieldDimension(field);
+    std::stringstream ss;
+    std::vector<T> output(dim);
+    for(int i=0;i<dim;i++){
+      int start = this->survey.getStartPosition(field)+i*dim;
+      int length = this->survey.getFieldLength(field);
+      ss.str(this->headerString.substr(pos,length));
+      ss >> output[i];      
+    }
+    return output[elementNumber];
+  }
+
+  template<> int DataBlock::getKeyword<int>(int field, int element){
+    return this->survey.readParameter<int>(this->headerString,field,element);
+  }
+  template<> float DataBlock::getKeyword<float>(int field, int element){
+    return this->survey.readParameter<float>(this->headerString,field,element);
+  }
+  template<> double DataBlock::getKeyword<double>(int field, int element){
+    return this->survey.readParameter<double>(this->headerString,field,element);
+  }
+  template<> string DataBlock::getKeyword<string>(int field, int element){
+   return this->survey.readParameter<string>(this->headerString,field,element);
+  }
+  //--------------------------------------------------------------------------
+  template <class T> 
+  std::vector<T> DataBlock::getFullKeyword(int field)
+  {
+    int dim = this->survey.getFieldDimension(field);
+    std::stringstream ss;
+    std::vector<T> output(dim);
+    for(int i=0;i<dim;i++){
+      int start = this->survey.getStartPosition(field)+i*dim;
+      int length = this->survey.getFieldLength(field);
+      ss.str(this->headerString.substr(pos,length));
+      ss >> output[i];      
+    }
+    return output;
+  }
+  template<> std::vector<int> DataBlock::getFullKeyword<int>(int field){
+    std::vector<int> output(this->survey.getFieldDimension(field));
+    for(int i=0;i<this->survey.getFieldDimension(field);i++)
+      output[i]=this->survey.readParameter<int>(this->headerString,field,i);
+    return output;
+  }
+  template<> std::vector<float> DataBlock::getFullKeyword<float>(int field){
+    std::vector<float> output(this->survey.getFieldDimension(field));
+    for(int i=0;i<this->survey.getFieldDimension(field);i++)
+      output[i]= this->survey.readParameter<float>(this->headerString,field,i);
+    return output;
+  }
+  template<> std::vector<string> DataBlock::getFullKeyword<string>(int field){
+    std::vector<string> output(this->survey.getFieldDimension(field));
+    for(int i=0;i<this->survey.getFieldDimension(field);i++)
+      output[i]=this->survey.readParameter<string>(this->headerString,field,i);
+    return output;
+  }
+
+}
Index: /trunk/src/Block.hh
===================================================================
--- /trunk/src/Block.hh	(revision 1)
+++ /trunk/src/Block.hh	(revision 1)
@@ -0,0 +1,40 @@
+#ifndef BLOCK_HH_
+#define BLOCK_HH_
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <vector>
+#include "Header.hh"
+
+namespace Block
+{
+  const int headerLength = 640;
+  const int dataLength = 49152; // = 48*1024
+
+  class DataBlock
+  {
+  public:
+//     DataBlock(std::string surveyName);
+    DataBlock(Header::SURVEY surveyType);
+    virtual ~DataBlock();
+    bool readBlock(std::ifstream &file);
+    bool readHeader(std::ifstream &file);
+    void readData(std::ifstream &file);
+    char getDatum(int i){return data[i];};
+    char *getData(){return data;};
+    std::string getSurveyName(){return surveyName;};
+    template <typename T> T getKeyword(int field, int element=0);
+    template <typename T> std::vector<T> getFullKeyword(int field);
+    Header::SurveySchema& Survey(){
+      Header::SurveySchema& rsurv=survey; return rsurv;
+    };
+
+  private:
+    std::string headerString;
+    Header::SurveySchema survey;
+    char *data;
+    std::string surveyName;
+  };
+
+}
+#endif /*BLOCK_HH_*/
Index: /trunk/src/Header.cc
===================================================================
--- /trunk/src/Header.cc	(revision 1)
+++ /trunk/src/Header.cc	(revision 1)
@@ -0,0 +1,139 @@
+#include "Header.hh"
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <vector>
+
+using std::string;
+namespace Header
+{
+
+  SurveySchema::SurveySchema(SURVEY surveyType)
+  {
+    if(surveyType == S70){
+      // This initialises the SurveyHeader arrays for the S70 setup.
+      int s70Start[numKeywords] = {0,8,12,16,20,
+				   28,36,44,60,
+				   72,74,90,106,114,
+				   602,602,122,130,138,
+				   202,204,220,228,
+				   252,276,284,292,602,300,
+				   304,320,332,348,364,372,380,388,
+				   396,602,428,492,500,508,
+				   516,598,520,524,536,540,
+				   556,560,568,576,578,584,586,
+				   588,602,602,602,602};
+      for(int i=0;i<numKeywords;i++) this->startPosition[i] = s70Start[i];
+      
+      int s70Length[numKeywords] = {8,4,4,4,8,
+				    8,8,16,12,
+				    2,16,16,8,8,
+				    0,0,8,8,64,
+				    2,8,4,12,
+				    12,4,8,8,0,4,
+				    16,12,16,16,8,8,8,8,
+				    8,0,8,8,8,8,
+				    4,4,4,12,4,16,
+				    2,8,4,2,6,2,2,
+				    10,0,0,0,38};
+      for(int i=0;i<numKeywords;i++) this->fieldLength[i] = s70Length[i];
+
+      int s70Dim[numKeywords] = {1,1,1,1,1,
+				 1,1,1,1,
+				 1,1,1,1,1,
+				 1,1,1,1,1,
+				 1,2,2,2,
+				 2,2,1,1,1,1,
+				 1,1,1,1,1,1,1,1,
+				 4,1,8,1,1,1,
+				 1,1,1,1,1,1,
+				 2,1,2,1,1,1,1,
+				 1,1,1,1,1};
+      for(int i=0;i<numKeywords;i++) this->fieldDimension[i] = s70Dim[i];
+    }
+    else if(surveyType == PM || surveyType == PH){
+      // This initialises the SurveyHeader arrays for the PM setup.
+      int pmStart[numKeywords] = {0,6,10,16,20,
+				  28,36,44,60,
+				  72,74,90,106,114,
+				  122,130,618,618,138,
+				  202,204,220,228,
+				  252,276,284,292,300,302,
+				  304,320,332,348,364,372,380,388,
+				  618,396,412,492,500,508,
+				  618,516,520,524,618,540,
+				  556,560,568,576,578,584,586,
+				  588,598,606,614,618};
+      for(int i=0;i<numKeywords;i++) this->startPosition[i] = pmStart[i];
+      
+      int pmLength[numKeywords] = {6,4,6,4,8,
+				   8,8,16,12,
+				   2,16,16,8,8,
+				   8,8,0,0,64,
+				   2,8,4,12,
+				   12,4,8,8,2,1,
+				   16,12,16,16,8,8,8,8,
+				   0,4,4,8,8,8,
+				   0,4,4,16,0,16,
+				   2,8,4,2,6,2,2,
+				   10,8,8,4,22};
+      for(int i=0;i<numKeywords;i++) this->fieldLength[i] = pmLength[i];
+
+      int pmDim[numKeywords] = {1,1,1,1,1,
+				1,1,1,1,
+				1,1,1,1,1,
+				1,1,1,1,1,
+				1,2,2,2,
+				2,2,1,1,1,2,
+				1,1,1,1,1,1,1,1,
+				1,4,20,1,1,1,
+				1,1,1,1,1,1,
+				2,1,2,1,1,1,1,
+				1,1,1,1,1};
+      for(int i=0;i<numKeywords;i++) this->fieldDimension[i] = pmDim[i];
+    }
+//     else throw xBadSurvey(surveyType);
+  }
+  //--------------------------------------------------------------------------
+
+  template <class T> 
+  T SurveySchema::readParameter(string headerString, int field,
+				int elementNumber)
+  {
+    int dim = this->fieldDimension[field];
+    int length = this->fieldLength[field];
+    int pos = this->startPosition[field];
+    std::stringstream ss;
+    std::vector<T> output(dim);
+    for(int i=0;i<dim;i++){
+      ss.str( headerString.substr(pos+elementNumber*length, length) );
+      ss >> output[i];    
+    }
+    return output[elementNumber];
+  }
+  template <> string 
+  SurveySchema::readParameter<string>(string headerString, 
+				      int field, int elementNumber)
+  {
+    int dim = this->fieldDimension[field];
+    int length = this->fieldLength[field];
+    int pos = this->startPosition[field];
+    return headerString.substr(pos+elementNumber*length, length);
+  }
+  template int SurveySchema::readParameter<int>(string headerString, 
+						int field,
+						int elementNumber);
+  template float SurveySchema::readParameter<float>(string headerString, 
+						    int field,
+						    int elementNumber);
+  template double SurveySchema::readParameter<double>(string headerString, 
+						      int field,
+						      int elementNumber);
+  template string SurveySchema::readParameter<string>(string headerString, 
+						    int field,
+						    int elementNumber);
+  //--------------------------------------------------------------------------
+
+
+
+}
Index: /trunk/src/Header.hh
===================================================================
--- /trunk/src/Header.hh	(revision 1)
+++ /trunk/src/Header.hh	(revision 1)
@@ -0,0 +1,82 @@
+#ifndef HEADER_HH_
+#define HEADER_HH_
+#include <string>
+#include <iostream>
+#include <fstream>  
+namespace Header
+{
+  enum SURVEY { S70, PM, PH };
+  inline SURVEY idSurvey(std::string file)
+  {
+    std::ifstream fin;
+    fin.open(file.c_str(), std::ios::binary);
+    char *hdr = new char[5];
+    fin.read( hdr, 5*sizeof(char) );
+    fin.close();
+    hdr[4] = '\0';
+    unsigned char compstring_s70[5] = {182, 'm', 'm', 219, 0};
+    unsigned char compstring_pm[4] = {'P', 'M', 'D'};
+    compstring_pm[3] = '\0';
+    if(strcmp((const char*)compstring_s70,hdr)==0) return S70;
+    if(strncmp((const char*)compstring_pm,hdr,3)==0) return PM;
+  }
+
+  enum ISMOVING { GRID=0, POINT, MOVING };
+
+  enum FIELDS 
+    {CODE=0, VERSION, TAPENR, SCAN_CNTR, BLK_CNTR, 
+     DATE, MJD, UT_STRT, LST_STRT, 
+     COORD_TYPE, RA_STRT, DEC_STRT, GL_STRT, GB_STRT, 
+     FEED_ANGLE, OBS_TIME, SCAN_RATE, SCAN_LEN, COMMENT, 
+     NFILTER, CHANBW, NCHAN, FREQ_CHAN1, 
+     SAMP_INT, SAMP_GRP, GRP_BLK, BLK_SEC, FDCNTRL, DATA_TYPE,
+     UT, LST, RA, DEC, GL, GB, TEL_ZEN, TEL_AZ, 
+     STATUS, ATTEN, TPOWER, NBLK_READ, SCAN_RATEL, SCAN_RATEB, 
+     BYTE_GRP, NBEAM, IBEAM, PSRNAME, DATA_TWO, OBS_FILEN, 
+     NBITS, DDM, NDDCH, MOVE, PNTERR, TREE, NSYS, 
+     TELID, PANGLE, SMP_BSW, CAL_CYCLE, RESERVE
+    };
+
+  const int numKeywords = RESERVE + 1;
+
+
+  class SurveySchema
+  {
+  public:
+    SurveySchema(){};
+    SurveySchema(SURVEY surveyType);
+    SurveySchema(const SurveySchema& s){
+    for(int i=0;i<numKeywords;i++) startPosition[i]  = s.startPosition[i];
+    for(int i=0;i<numKeywords;i++) fieldLength[i]    = s.fieldLength[i];
+    for(int i=0;i<numKeywords;i++) fieldDimension[i] = s.fieldDimension[i];
+    };
+    SurveySchema& operator= (const SurveySchema& s){
+    for(int i=0;i<numKeywords;i++) startPosition[i]  = s.startPosition[i];
+    for(int i=0;i<numKeywords;i++) fieldLength[i]    = s.fieldLength[i];
+    for(int i=0;i<numKeywords;i++) fieldDimension[i] = s.fieldDimension[i];
+    };
+    virtual ~SurveySchema(){};
+    int getStartPosition(int field){return startPosition[field];};
+    int getFieldLength(int field){return fieldLength[field];};
+    int getFieldDimension(int field){return fieldDimension[field];};
+    template <class T> T readParameter(std::string headerString, int field,
+				       int elementNumber = 0);
+    class xBadSurvey{
+    public:
+      xBadSurvey(std::string s){surveyName=s;};
+      virtual ~xBadSurvey(){};
+      std::string getSurvey(){return surveyName;};
+    private:
+      std::string surveyName;
+    };
+ 
+  private:
+    int startPosition[numKeywords];
+    int fieldLength[numKeywords];
+    int fieldDimension[numKeywords];
+  };
+
+}
+
+
+#endif /*HEADER_HH_*/
Index: /trunk/src/Makefile
===================================================================
--- /trunk/src/Makefile	(revision 486)
+++ /trunk/src/Makefile	(revision 1)
@@ -1,59 +1,24 @@
-#BASE = ./src
 BASE = .
-
-DEBUG=
-
 TEST = $(BASE)/tests
 
-INSTALLDIR = /u/whi550/bin
+HEADER = $(BASE)/Header.o
 
-HEADER = $(BASE)/pvo-header.o
+BLOCK = $(BASE)/Block.o
 
-BLOCK = $(BASE)/pvo-block.o
+PSRFITS = $(BASE)/PSRFits.o
 
-PSRFITS = $(BASE)/pvo-FITS.o\
-	$(BASE)/pvo-FITS-fileIO.o
+UTILS = $(BASE)/Utils.o
 
-UTILS = $(BASE)/pvo-utils.o
-
-METADATA = $(BASE)/pvo-metadata.o
-
-ifeq ($(HOST), bilby)
- CFITSIODIR = /Users/whi550/lib
-# CFITSIOINC = -I/Users/whi550/include/cfitsio
- CFITSIOINC =#-I/Users/whi550/include
-# CFITSIOLIB = -L$(CFITSIODIR) -lcfitsio
- CFITSIOLIB = -lcfitsio
-else
- ifeq ($(DEBUG),-g)
-  CFITSIODIR = /DATA/SITAR_1/whi550/Packages/cfitsio-myHack-debug
- else
-  CFITSIODIR = /DATA/SITAR_1/whi550/Packages/cfitsio
- endif
- CFITSIOINC = -I$(CFITSIODIR)
- CFITSIOLIB = -L$(CFITSIODIR) -lcfitsio
-endif
+# CFITSIODIR = /DATA/SITAR_1/whi550/Packages/cfitsio
+CFITSIODIR = /DATA/SITAR_1/whi550/Packages/cfitsio-myHack
+# CFITSIODIR = /DATA/SITAR_1/whi550/Packages/cfitsio-myHack-debug
+CFITSIOINC = -I$(CFITSIODIR)
+CFITSIOLIB = -L$(CFITSIODIR) -lcfitsio
 
 LIBS = $(CFITSIOLIB) -lm
 CINC=  $(CFITSIOINC)
 
-USE_PVO_HH = $(BASE)/pvoconesearch.o\
-	$(BASE)/pvotapesummary.o\
-	$(BASE)/pvoconvert.o\
-	$(BASE)/pvo-FITS.o\
-	$(BASE)/pvo-metadata.o\
-	$(BASE)/pvosummary.o
-
-USE_METADATA_HH = $(BASE)/pvo-metadata.o\
-	$(BASE)/pvosummary.o\
-	$(BASE)/pvoconesearch.o
-
-USE_HEADER_HH =  $(BASE)/pvoconvert.o\
-	$(BASE)/pvosummary.o\
-	$(BASE)/pvoconesearch.o\
-	$(BASE)/pvo-header.o\
-	$(BASE)/pvo-block.o\
-	$(BASE)/pvo-FITS.o\
-	$(BASE)/pvo-FITS-fileIO.o\
+USE_HEADER_HH =  $(BASE)/Header.o\
+	$(BASE)/Block.o\
 	$(TEST)/headertest.o\
 	$(TEST)/blocktest.o\
@@ -62,10 +27,5 @@
 	$(TEST)/testDataAccess.o
 
-USE_BLOCK_HH =  $(BASE)/pvoconvert.o\
-	$(BASE)/pvosummary.o\
-	$(BASE)/pvoconesearch.o\
-	$(BASE)/pvo-block.o\
-	$(BASE)/pvo-FITS.o\
-	$(BASE)/pvo-FITS-fileIO.o\
+USE_BLOCK_HH =  $(BASE)/Block.o\
 	$(TEST)/psrfitstest.o\
 	$(TEST)/blocktest.o\
@@ -73,13 +33,5 @@
 	$(TEST)/testDataAccess.o 
 
-USE_UTILS_HH =  $(BASE)/pvoconvert.o\
-	$(BASE)/pvosummary.o\
-	$(BASE)/pvoconesearch.o\
-	$(BASE)/print_s70_data.o\
-	$(BASE)/pvo-utils.o\
-	$(BASE)/pvo-block.o\
-	$(BASE)/pvo-FITS.o\
-	$(BASE)/pvo-FITS-fileIO.o\
-	$(TEST)/blocktest.o\
+USE_UTILS_HH =  $(TEST)/blocktest.o\
 	$(TEST)/psrfitstest.o\
 	$(TEST)/testallheaders.o\
@@ -89,45 +41,9 @@
 	$(TEST)/testFitsBinTable.o
 
-USE_PSRFITS_HH = $(BASE)/pvoconvert.o\
-	$(BASE)/pvosummary.o\
-	$(BASE)/pvoconesearch.o\
-	$(BASE)/pvo-FITS.o\
-	$(BASE)/pvo-FITS-fileIO.o\
-	$(TEST)/psrfitstest.o\
+USE_PSRFITS_HH = $(TEST)/psrfitstest.o\
 	$(TEST)/blocktest.o\
 	$(TEST)/testallheaders.o\
 	$(TEST)/testDataAccess.o\
 	$(TEST)/testFitsCreation.o
-
-all : pvoconvert pvosummary pvoconesearch pvotapesummary pvofixfilename
-
-pvoconvert : $(BASE)/pvoconvert.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS)
-	$(CXX) -o pvoconvert.x $(BASE)/pvoconvert.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(LIBS)
-
-install : pvoconvert pvosummary
-	cp pvoconvert.x $(INSTALLDIR)/pvoconvert
-	cp pvosummary.x $(INSTALLDIR)/pvosummary
-	cp pvoconesearch.x $(INSTALLDIR)/pvoconesearch
-
-pvosummary : $(BASE)/pvosummary.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(METADATA)
-	$(CXX) -o pvosummary.x $(BASE)/pvosummary.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(METADATA) $(LIBS)
-
-pvoconesearch : $(BASE)/pvoconesearch.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(METADATA)
-	$(CXX) -o pvoconesearch.x $(BASE)/pvoconesearch.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(METADATA) $(LIBS)
-
-pvosummary2 : $(BASE)/pvosummary-glob.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS)
-	$(CXX) -o pvosummary2.x $(BASE)/pvosummary-glob.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(LIBS)
-
-pvotapesummary : $(BASE)/pvotapesummary.o $(HEADER) $(BLOCK) $(UTILS)
-	$(CXX) -o pvotapesummary.x $(BASE)/pvotapesummary.o $(HEADER) $(BLOCK)  $(UTILS) $(LIBS)
-
-pvofixfilename : $(BASE)/pvofixfilename.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS)
-	$(CXX) -o pvofixfilename.x $(BASE)/pvofixfilename.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(LIBS)
-
-testNewPSRF : $(TEST)/testNewPsrfits.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS)
-	$(CXX) -o testNewPSRF.x $(TEST)/testNewPsrfits.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(LIBS)
-
-testMove : $(TEST)/testMoving.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS)
-	$(CXX) -o testMove.x $(TEST)/testMoving.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(LIBS)
 
 testhead : $(TEST)/headertest.o $(HEADER)
@@ -149,47 +65,27 @@
 	$(CXX) -o testdata.x $(TEST)/testDataAccess.o $(HEADER) $(BLOCK)
 
-testfits1 : $(TEST)/testFitsCreation.o $(BASE)/pvo-utils.o
-	$(CXX) -o testfits1.x $(TEST)/testFitsCreation.o $(BASE)/pvo-utils.o $(LIBS)
+testfits1 : $(TEST)/testFitsCreation.o
+	$(CXX) -o testfits1.x $(TEST)/testFitsCreation.o $(LIBS)
 
 testfits2 : $(TEST)/testFitsKeywords.o
 	$(CXX) -o testfits2.x $(TEST)/testFitsKeywords.o $(LIBS)
 
-testfits3 : $(TEST)/testFitsBinTable.o $(UTILS)
-	$(CXX) -o testfits3.x $(TEST)/testFitsBinTable.o $(UTILS) $(LIBS)
+testfits3 : $(TEST)/testFitsBinTable.o
+	$(CXX) -o testfits3.x $(TEST)/testFitsBinTable.o $(LIBS)
 
 testfits4 : $(TEST)/testFitsBinTableSml.o
 	$(CXX) -o testfits4.x $(TEST)/testFitsBinTableSml.o $(LIBS)
 
-testTime : $(TEST)/testTimeFormats.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS)
-	$(CXX) -o testTime.x $(TEST)/testTimeFormats.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(LIBS)
+s70 : $(TEST)/test_s70_data_read.cc
+	$(CXX) -o s70.x $(TEST)/test_s70_data_read.cc
 
-s70 : $(BASE)/print_s70_data.cc $(UTILS)
-	$(CXX) -o s70.x $(BASE)/print_s70_data.cc $(UTILS)
-
-pm : $(BASE)/print_pm_data.cc
-	$(CXX) -o pm.x $(BASE)/print_pm_data.cc
-
-makeFake : $(TEST)/makeFakeData.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS)
-	$(CXX) -o makeFake.x $(TEST)/makeFakeData.o $(HEADER) $(BLOCK) $(PSRFITS) $(UTILS) $(LIBS)
-
-testAngSep : $(TEST)/testAngSepFunctions.cc
-	$(CXX) -c $(TEST)/testAngSepFunctions.cc -o $(TEST)/testAngSepFunctions.o -I/usr/local/pgplot -I$(DUCHAMP_CODE)/src -I $(BASE)
-	$(CXX) -o testAngSep.x $(TEST)/testAngSepFunctions.o $(BASE)/pvo-utils.o -lcpgplot -lpgplot -L/u/whi550/CubeFinder -lpng -L/usr/X11R6/lib -lX11 -lg2c
-
-testBitToggle: $(TEST)/testBitToggle.cc $(UTILS)
-	$(CXX) -o testBitToggle.x $(TEST)/testBitToggle.cc $(UTILS) 
-
-$(USE_PVO_HH) : $(BASE)/pvo.hh
-$(USE_UTILS_HH) : $(BASE)/pvo-utils.hh
-$(USE_HEADER_HH) : $(BASE)/pvo-header.hh
-$(USE_BLOCK_HH) : $(BASE)/pvo-block.hh
-$(USE_PSRFITS_HH) : $(BASE)/pvo-FITS.hh
-$(USE_METADATA_HH) : $(BASE)/pvo-metadata.hh
+pm : $(TEST)/test_pttape_read.cc
+	$(CXX) -o pm.x $(TEST)/test_pttape_read.cc
 
 .cc.o:
-	$(CXX) $(DEBUG) -c $< $(CINC) -o $@
+	$(CXX) -c $< $(CINC) -o $@
 
 .c.o:
-	$(CC) $(DEBUG) -c $< $(CINC) -o $@
+	$(CC) -c $< $(CINC) -o $@
 
 .tex:
@@ -197,2 +93,8 @@
 clean : 
 	rm -f $(BASE)/*.o $(TEST)/*.o 
+
+USE_UTILS_HH : $(BASE)/Utils.hh
+USE_HEADER_HH : $(BASE)/Header.hh
+USE_BLOCK_HH : $(BASE)/Block.hh
+USE_PSRFITS_HH : $(BASE)/PSRFits.hh
+
Index: unk/src/Makefile.psr
===================================================================
--- /trunk/src/Makefile.psr	(revision 486)
+++ 	(revision )
@@ -1,34 +1,0 @@
-#-*-Makefile-*- helps emacs recognize this file as a Makefile
-
-LOCAL_ROOT = /psr/cvshome/man082
-include $(LOCAL_ROOT)/include/Makefile.standard
-
-# BINDIR = $(PSRHOME)/bin/$(LOGIN_ARCH)
- BINDIR = $(PSRHOME)/$(LOGIN_ARCH)/bin
-
-INCLUDES = pvo-FITS.hh  pvo-block.hh  pvo-header.hh  pvo-utils.hh  pvo-metadata.hh
-
-# This forces us to use the fitsio.h file in /psr/linux/include, which
-# is of a later version than /psr/packages/linux/include. This later
-# version is needed so that we can use the function fits_file_exists,
-# which is not present in CFITSIO versions before v.3
- INCFLAGS := -I$(PSRHOME)/$(LOGIN_ARCH)/include $(INCFLAGS)
-
-# Also fix the library so that we use the correct version.
- LDFLAGS := -L$(PSRHOME)/$(LOGIN_ARCH)/lib -lcfitsio #$(LDFLAGS)
-# LDFLAGS := $(LDFLAGS) -lcfitsio -lm
-
-PROGRAMS = pvoconvert.C pvosummary.C pvotapesummary.C pvoconesearch.C pvofixfilename.C
-
-pvoconvert.srcs = pvo-header.C  pvo-block.C  pvo-utils.C pvo-FITS.C  pvo-FITS-fileIO.C  
-
-pvosummary.srcs = pvo-header.C  pvo-block.C  pvo-utils.C pvo-FITS.C  pvo-FITS-fileIO.C  pvo-metadata.C
-
-pvotapesummary.srcs = pvo-header.C  pvo-block.C  pvo-utils.C 
-
-pvoconesearch.srcs = pvo-header.C  pvo-block.C  pvo-utils.C pvo-FITS.C  pvo-FITS-fileIO.C  pvo-metadata.C
-
-pvofixfilename.srcs = pvo-header.C  pvo-block.C  pvo-utils.C pvo-FITS.C  pvo-FITS-fileIO.C
-
-include $(LOCAL_ROOT)/include/Makefile.extended
-
Index: /trunk/src/PSRFits.cc
===================================================================
--- /trunk/src/PSRFits.cc	(revision 1)
+++ /trunk/src/PSRFits.cc	(revision 1)
@@ -0,0 +1,439 @@
+#include "PSRFits.hh"
+#include <iostream>
+#include <string>
+#include "Utils.hh"
+#include "Block.hh"
+#include "Header.hh"
+
+#define USE_X true
+
+using namespace Block;
+using namespace Header;
+
+namespace FITS
+{
+  
+  void FITSError(std::string function, int status)
+  {
+    std::cerr << "FITSError <" << function << "> (status="<<status<<"): ";
+    fits_report_error(stderr, status);
+  }
+ //--------------------------------------------------------------------------
+
+  PSRFits::PSRFits()
+  {
+    this->newFile = true;
+    this->filestate = CLOSED;
+  }
+ //--------------------------------------------------------------------------
+
+  PSRFits::PSRFits(std::string name)
+  {
+    this->filestate = CLOSED;
+    this->openFile(name);
+  }
+ //--------------------------------------------------------------------------
+
+  PSRFits::~PSRFits()
+  {
+  }
+ //--------------------------------------------------------------------------
+
+  int PSRFits::openFile(std::string name)
+  {
+    int status = 0;
+    char *template_file = (char *)getPSRFITSdefn().c_str();
+    fits_create_template(&this->fptr, name.c_str(), template_file, &status);
+    if(status) FITSError("PSRFits::openFile",status);
+    else{
+      this->newFile = true;
+      this->filestate = OPEN;
+      this->fixPSRFITS();
+    }
+    return status;
+  }
+ //--------------------------------------------------------------------------
+  
+  int PSRFits::closeFile()
+  {
+    int status = 0;
+    if(this->filestate == OPEN){
+      fits_close_file(this->fptr, &status);
+      if(status) FITSError("PSRFits::closeFile",status);
+      this->filestate = CLOSED;
+    }
+    return status;
+  }
+ //--------------------------------------------------------------------------
+  
+  int PSRFits::gotoPHU()
+  {
+    int status = 0;
+    fits_movabs_hdu(this->fptr, 1, NULL, &status);    
+    if(status) FITSError("PSRFits::gotoPHU",status);
+    return status;
+  }
+ //--------------------------------------------------------------------------
+  
+  int PSRFits::gotoSubint()
+  {
+    int status = 0;
+    fits_movnam_hdu(this->fptr, ANY_HDU, "subint", 0, &status);
+    if(status) FITSError("PSRFits::gotoSubint",status);
+    return status;
+  }
+ //--------------------------------------------------------------------------
+  
+  template <typename T> int PSRFits::updateKeyword(std::string name, T value)
+  {
+    int status=0;
+    fits_update_key(this->fptr, TINT, name.c_str(), &value, NULL, &status);
+    if(status) FITSError("PSRFits::updateKeyword",status);
+    return status;
+  }
+  template <> int PSRFits::updateKeyword(std::string name, int value){
+    int status=0;
+    fits_update_key(this->fptr, TINT, (char *)name.c_str(), 
+		    &value, NULL, &status);
+    if(status) FITSError("PSRFits::updateKeyword",status);
+    return status;
+  }
+  template <> int PSRFits::updateKeyword(std::string name, float value){
+    int status=0;
+    fits_update_key(this->fptr, TFLOAT, (char *)name.c_str(),
+		    &value, NULL, &status);
+    if(status) FITSError("PSRFits::updateKeyword",status);
+    return status;
+  }
+  template <> int PSRFits::updateKeyword(std::string name, double value){
+    int status=0;
+    fits_update_key(this->fptr, TDOUBLE, (char *)name.c_str(), 
+		    &value, NULL, &status);
+    if(status) FITSError("PSRFits::updateKeyword",status);
+    return status;
+  }
+  template <> int PSRFits::updateKeyword(std::string name, std::string value){
+    int status=0;
+    fits_update_key(this->fptr, TSTRING, (char *)name.c_str(), 
+		    (char *)value.c_str(), NULL, &status);
+    if(status) FITSError("PSRFits::updateKeyword",status);
+    return status;
+  }
+  template <> int PSRFits::updateKeyword(std::string name, char *value){
+    int status=0;
+    fits_update_key(this->fptr, TSTRING, (char *)name.c_str(), 
+		    value, NULL, &status);
+    if(status) FITSError("PSRFits::updateKeyword",status);
+    return status;
+  }
+ //--------------------------------------------------------------------------
+
+  int PSRFits::getColnum(char *name){
+    int status=0,colnum=0;
+    fits_get_colnum(this->fptr, CASEINSEN, name, &colnum, &status);
+    if(status) FITSError("getColnum", status);
+    return colnum;
+  }
+  
+  long PSRFits::getNumRows(){
+    int status=0;
+    long nrows=0;
+    fits_get_num_rows(this->fptr, &nrows, &status);
+    if(status) FITSError("getNumRows", status);
+    return nrows;
+  }
+  
+  template <class T> int PSRFits::writeColumnValue(char *name, T value)
+  {
+    int status=0;
+    int colnum = this->getColnum(name);
+    long nrows = this->getNumRows();
+    fits_write_col(this->fptr, TINT, colnum, nrows, 1, 1, &value, &status);
+    if(status) FITSError("PSRFits::writeColumnValue", status);
+    return status;
+  }
+  template <> int PSRFits::writeColumnValue(char *name, long value)
+  {
+    int status=0;
+    int colnum = this->getColnum(name);
+    long nrows = this->getNumRows();
+    fits_write_col(this->fptr, TLONG, colnum, nrows, 1, 1, &value, &status);
+    if(status) FITSError("PSRFits::writeColumnValue", status);
+    return status;
+  }
+  template <> int PSRFits::writeColumnValue(char *name, float value)
+  {
+    int status=0;
+    int colnum = this->getColnum(name);
+    long nrows = this->getNumRows();
+    fits_write_col(this->fptr, TFLOAT, colnum, nrows, 1, 1, &value, &status);
+    if(status) FITSError("PSRFits::writeColumnValue", status);
+    return status;
+  }
+  template <> int PSRFits::writeColumnValue(char *name, double value)
+  {
+    int status=0;
+    int colnum = this->getColnum(name);
+    long nrows = this->getNumRows();
+    fits_write_col(this->fptr, TDOUBLE, colnum, nrows, 1, 1, &value, &status);
+    if(status) FITSError("PSRFits::writeColumnValue", status);
+    return status;
+  }
+ //--------------------------------------------------------------------------
+
+  int PSRFits::startNewRow()
+  {
+    int nrows = this->getNumRows();
+    int status = 0;
+    fits_insert_rows(this->fptr, nrows, 1, &status);
+    this->writeColumnValue("ISUBINT", nrows+1);
+    if(status) FITSError("PSRFits::startNewRow", status);
+    return status;
+  }
+ //--------------------------------------------------------------------------
+
+  void PSRFits::writePHU(DataBlock &block)
+  {
+    this->gotoPHU();
+
+    char *todaysdate;
+    int timeref,status=0;
+    fits_get_system_time(todaysdate, &timeref, &status);
+    
+    int ct=1;
+    this->updateKeyword("DATE", todaysdate);
+//     this->updateKeyword("PROJID", block.getSurveyName());
+    this->updateKeyword("TELESCOP", block.getKeyword<std::string>(TELID));
+//     this->updateKeyword("ANT_X", block.Survey().getAntX());          
+//     this->updateKeyword("ANT_Y", block.Survey().getAntY());        
+//     this->updateKeyword("ANT_Z", block.Survey().getAntZ());        
+    //CHECK -- find out these correct values
+//     this->updateKeyword("FRONTEND" **survey-dependent** );
+//     this->updateKeyword("FD_POLN " **survey-dependent** );
+//     this->updateKeyword("FD_HAND " **survey-dependent** );
+//     this->updateKeyword("FD_SANG " **survey-dependent** );
+//     this->updateKeyword("FD_XYPH " **survey-dependent** );
+//     this->updateKeyword("BACKEND " **survey-dependent** );
+//     this->updateKeyword("BECONFIG" **survey-dependent** );
+//     this->updateKeyword("BE_PHASE" **survey-dependent** );
+//     this->updateKeyword("BE_DCC  " **survey-dependent** );
+//     this->updateKeyword("TCYCLE  " **survey-dependent** );
+    this->updateKeyword("NRCVR", block.getKeyword<int>(NFILTER));          
+    this->updateKeyword("OBS_MODE", PHU_kw_obs_mode);
+    this->updateKeyword("SRC_NAME", block.getKeyword<std::string>(PSRNAME));
+    //  CHECK -- NEED TO DECIDE ON RA/DEC OR GL/GB
+    this->updateKeyword("COORD_MD", PHU_kw_coord_md);
+    this->updateKeyword("STT_CRD1", block.getKeyword<std::string>(RA_STRT));
+    this->updateKeyword("STT_CRD2", block.getKeyword<std::string>(DEC_STRT));
+
+//     this->updateKeyword("TRK_MODE",    **irrelevant**       );
+    this->updateKeyword("STP_CRD1", block.getKeyword<std::string>(RA_STRT));
+    this->updateKeyword("STP_CRD2", block.getKeyword<std::string>(DEC_STRT));
+
+//     this->updateKeyword("SCANLEN", block.Survey().getScanLen());
+    this->updateKeyword("FD_MODE", block.getKeyword<std::string>(FDCNTRL));
+    this->updateKeyword("FA_REQ", block.getKeyword<float>(FEED_ANGLE));       
+//     this->updateKeyword("CAL_MODE" **no information**   );
+//     this->updateKeyword("CAL_FREQ" **no information**   );
+    this->updateKeyword("CAL_DCYC", block.getKeyword<std::string>(CAL_CYCLE));
+    //     this->updateKeyword("CAL_PHS ", **no information**   );
+    // CHECK -- STT_DATE NEEDS TO BE PUT INTO A STANDARD FORMAT.
+    std::string stt_date = block.getKeyword<std::string>(DATE);
+    if(stt_date[0] == '0') stt_date = "20" + stt_date;
+    else                   stt_date = "19" + stt_date;
+    this->updateKeyword("STT_DATE", stt_date);
+    this->updateKeyword("STT_TIME", block.getKeyword<std::string>(UT_STRT));
+    this->updateKeyword("STT_IMJD", block.getKeyword<int>(MJD));
+//     this->updateKeyword("STT_SMJD" **calculatable**     );
+//     this->updateKeyword("STT_OFFS" **unclear**          );
+    this->updateKeyword("STT_LST ", 
+			dmsToDec(block.getKeyword<std::string>(LST_STRT)) );
+  }
+ //--------------------------------------------------------------------------
+
+  void PSRFits::writeSubint(DataBlock &block)
+  {
+    this->gotoSubint();
+    int ct = 1;
+
+    this->updateKeyword("NCH_FILE", block.getKeyword<int>(NCHAN));
+    this->updateKeyword("INT_TYPE", SUBINT_kw_int_type);
+    this->updateKeyword("INT_UNIT", SUBINT_kw_int_unit);
+    this->updateKeyword("NCH_STRT", SUBINT_kw_nch_strt);
+
+    float off_sub;
+    // CHECK -- OFF_SUB is the offset, from the start (taken to mean the 
+    // CHECK -- starting time listed in the PHU), of the centre of the 
+    // CHECK -- current subintegration.
+    // CHECK -- This will need to be calculated from the keywords UT_STRT
+    // CHECK -- and UT (being the UT at the *start* of the current block)
+
+
+    this->startNewRow(); 
+    // CHECK -- need some check of blk_cntr to make sure the number is 
+    // CHECK -- incrementing correctly?
+    this->writeColumnValue("TSUBINT",  block.getKeyword<float>(BLK_SEC));
+    this->writeColumnValue("OFFS_SUB", off_sub);
+    this->writeColumnValue("LST_SUB",  
+			   dmsToDec(block.getKeyword<std::string>(LST)) );
+    this->writeColumnValue("RA_SUB",   
+			   dmsToDec(block.getKeyword<std::string>(RA))*15. );
+    this->writeColumnValue("DEC_SUB",  
+			   dmsToDec(block.getKeyword<std::string>(DEC)) );
+    this->writeColumnValue("GLON_SUB", block.getKeyword<double>(GL));
+    this->writeColumnValue("GLAT_SUB", block.getKeyword<double>(GB));
+    this->writeColumnValue("FD_ANG",   block.getKeyword<float>(FEED_ANGLE));
+//     this->writeColumnValue("POS_ANG",  posang);
+    this->writeColumnValue("PAR_ANG",  block.getKeyword<float>(PANGLE));
+    this->writeColumnValue("TEL_AZ",   block.getKeyword<float>(TEL_AZ));
+    this->writeColumnValue("TEL_ZEN",  block.getKeyword<float>(TEL_ZEN));
+    
+    this->writeSupportArrays(block); //DAT_FREQ,DAT_WTS,DAT_OFFS,DAT_SCL
+
+    this->writeDataArray(block);
+   
+  }
+ //--------------------------------------------------------------------------
+
+  void PSRFits::writeSupportArrays(DataBlock &block)
+  {
+    int numChannels = block.getKeyword<int>(NCHAN);
+    float *dat_freq = new float[numChannels];
+    dat_freq[0] = block.getKeyword<float>(FREQ_CHAN1);
+    float deltaFreq = block.getKeyword<float>(CHANBW) / float(numChannels);
+    for(int i=1;i<numChannels;i++) dat_freq[i] = dat_freq[i-1] + deltaFreq;
+
+    float *dat_wts = new float[numChannels];
+    for(int i=0;i<numChannels;i++) dat_wts[i] = 1.;
+    float *dat_offs = new float[numChannels];
+    for(int i=0;i<numChannels;i++) dat_offs[i] = 0.;
+    float *dat_scl = new float[numChannels];
+    for(int i=0;i<numChannels;i++) dat_scl[i] = 1.;
+
+    int status = 0;
+    long nrows = this->getNumRows();
+
+    int colnum = this->getColnum("DAT_FREQ");
+    status=0;
+    fits_modify_vector_len (fptr, colnum, numChannels, &status);
+    if(status) FITSError("PSRFits::writeSupportArray", status);
+    status=0;
+    fits_write_col(this->fptr, TFLOAT, colnum, nrows, 1, 
+		   numChannels, dat_freq, &status);
+    if(status) FITSError("PSRFits::writeSupportArrays", status);
+
+    colnum = this->getColnum("DAT_WTS");
+    status=0;
+    fits_modify_vector_len (fptr, colnum, numChannels, &status);
+    if(status) FITSError("PSRFits::writeSupportArray", status);
+    status=0;
+    fits_write_col(this->fptr, TFLOAT, colnum, nrows, 1, 
+		   numChannels, dat_wts, &status);
+    if(status) FITSError("PSRFits::writeSupportArrays", status);
+
+    colnum = this->getColnum("DAT_OFFS");
+    status=0;
+    fits_modify_vector_len (fptr, colnum, numChannels, &status);
+    if(status) FITSError("PSRFits::writeSupportArray", status);
+    status=0;
+    fits_write_col(this->fptr, TFLOAT, colnum, nrows, 1, 
+		   numChannels, dat_offs, &status);
+    if(status) FITSError("PSRFits::writeSupportArrays", status);
+
+    colnum = this->getColnum("DAT_SCL");
+    status=0;
+    fits_modify_vector_len (fptr, colnum, numChannels, &status);
+    if(status) FITSError("PSRFits::writeSupportArray", status);
+    status=0;
+    fits_write_col(this->fptr, TFLOAT, colnum, nrows, 1, 
+		   numChannels, dat_scl, &status);
+    if(status) FITSError("PSRFits::writeSupportArrays", status);
+
+  }
+ //--------------------------------------------------------------------------
+
+  void PSRFits::writeDataArray(DataBlock &block)
+  {
+    long nrows = this->getNumRows();
+    int colnum = this->getColnum("DATA");
+    int status = 0;
+
+    int numChan = block.getKeyword<int>(NCHAN,0);
+    int numPol  = block.getKeyword<int>(NFILTER);
+    // CHECK -- HOW DOES NFILTER COMPARE TO NPOL???
+    int numBin  = block.getKeyword<int>(SAMP_GRP,0) * 
+      block.getKeyword<int>(GRP_BLK);
+
+    int dataPerByte = 8 / block.getKeyword<int>(NBITS,0);
+
+
+    int numData = numChan * numPol * numBin;
+    //CHECK -- IS THIS CONVERSION TO BYTES CORRECT?
+    int numBytes = numData / dataPerByte;   
+
+    unsigned char *data = (unsigned char *)block.getData();
+
+    //Fixing size of vector
+    if(this->newFile){
+      status=0;
+      if(USE_X) fits_modify_vector_len (this->fptr, colnum, numData, &status);
+      else      fits_modify_vector_len (this->fptr, colnum, numBytes, &status);
+      if(status) FITSError("PSRFits::writeDataArray", status);
+    }
+ 
+     long naxis=3,naxes[3];
+    // CHECK -- ORDER OF AXES: first axis is quickest-varying one, so this is 
+    // CHECK --  the channel axis. Next quickest is the pol axis (equivalent 
+    // CHECK --  to the filter? CHECK THIS). Slowest varying is the sample  
+    // CHECK --  axis (which has length numBin).
+    // CHECK -- IS THE CONVERSION TO BYTES CORRECT? We are dividing the channel
+    // CHECK --  axis, as this should be divisible by 8.
+    if(USE_X) naxes[0] = numChan; 
+    else      naxes[0] = numChan / dataPerByte; 
+    naxes[1] = numPol;
+    naxes[2] = numBin;
+    if(this->newFile){
+      status=0;
+      fits_write_tdim(this->fptr, colnum, naxis, naxes, &status);
+      if(status) FITSError("PSRFits::writeDataArray", status);
+    }
+
+    status=0;
+    fits_write_col_byt(fptr, colnum, nrows, 1, numBytes, data, &status);
+//     fits_write_col(this->fptr, TBYTE, colnum, nrows, 1, numBytes, data, &status);
+    if(status) FITSError("PSRFits::writeDataArray1", status);
+
+    if(USE_X && this->newFile) {
+      this->newFile = false;
+      status=0;
+      fits_delete_rows(this->fptr, nrows+1, 1, &status);
+      if(status) FITSError("PSRFits::writeDataArray", status);
+    }
+
+  
+
+  }
+ //--------------------------------------------------------------------------
+
+  void PSRFits::fixPSRFITS()
+  {
+    this->gotoSubint();
+    
+    int status=0;
+    char cval[9];
+    if(USE_X) strcpy(cval,"16X");
+    else      strcpy(cval,"2B");
+    fits_update_key(fptr, TSTRING, "TFORM19", cval, NULL, &status);
+    if(status) FITSError("PSRFits::fixPSRFITS", status);
+//     strcpy(cval,"deg");
+//     fits_update_key(fptr, TSTRING, "TUNIT6", cval, NULL, &status);
+//     if(status) FITSError("PSRFits::fixPSRFITS", status);
+//     fits_update_key(fptr, TSTRING, "TUNIT7", cval, NULL, &status);
+//     if(status) FITSError("PSRFits::fixPSRFITS", status);
+
+    this->gotoPHU();
+  }
+
+
+
+}
Index: /trunk/src/PSRFits.hh
===================================================================
--- /trunk/src/PSRFits.hh	(revision 1)
+++ /trunk/src/PSRFits.hh	(revision 1)
@@ -0,0 +1,60 @@
+#ifndef PSRFITS_HH_
+#define PSRFITS_HH_
+#include <fitsio.h>
+#include <string>
+#include "Block.hh"
+#include "Header.hh"
+
+using namespace Block;
+using namespace Header;
+
+namespace FITS
+{
+	
+  //	enum HDU = {PHU=1, HISTORY, DIG_STAT, DIG_CNTS, 
+
+  enum STATE { OPEN, CLOSED }; 
+	
+  void FITSError(std::string function, int status);
+  
+  const int SUBINT_kw_nch_strt = 0;
+  const std::string SUBINT_kw_int_type = "TIME";
+  const std::string SUBINT_kw_int_unit = "SEC";
+  const std::string PHU_kw_obs_mode = "SEARCH";
+  const std::string PHU_kw_coord_md = "J2000.0";
+  
+  class PSRFits
+  {
+  public:
+    PSRFits();
+    PSRFits(std::string name);
+    virtual ~PSRFits();
+    bool isNewFile(){return newFile;};
+    int openFile(std::string name);
+    void fixPSRFITS();
+    int closeFile();
+    STATE getFilestate(){return filestate;};
+    void setFilestate(STATE S){filestate=S;};
+    int gotoPHU();
+    int gotoSubint();
+    template <class T> int updateKeyword(std::string name, T value); 
+    template <class T> int writeColumnValue(char *name, T value);
+    int getColnum(char *name);
+    long getNumRows();
+    int startNewRow();
+    void writePHU(DataBlock &block);
+    void writeSubint(DataBlock &block);
+    void startNewColumn();
+    void writeColumnValue();
+    void writeSupportArrays(DataBlock &block);
+    void writeDataArray(DataBlock &block);
+    
+
+  private:
+    fitsfile *fptr;
+    bool newFile;
+    STATE filestate;
+  };
+
+}
+#endif /*PSRFITS_HH_*/
Index: /trunk/src/Utils.cc
===================================================================
--- /trunk/src/Utils.cc	(revision 1)
+++ /trunk/src/Utils.cc	(revision 1)
@@ -0,0 +1,39 @@
+#include "Utils.hh"
+#include <string>
+
+double dmsToDec(std::string input)
+{
+  /** 
+   *  double dmsToDec(string)
+   *   Converts a string in the format +12:23:34.45 to a decimal angle in 
+   *    degrees.
+   *   Assumes the angle given is in degrees, so if passing RA as the argument,
+   *   need to multiply by 15 to get the result in degrees rather than hours.
+   *   The sign of the angle is preserved, if present.
+   */
+
+  std::string dms = removeLeadingBlanks(input);
+
+  bool isNeg = false;
+  if(dms[0]=='-') isNeg = true;
+
+  for(int i=0;i<dms.size();i++) if(dms[i]==':') dms[i]=' ';
+
+  std::stringstream ss;
+  ss.str(dms);
+
+  std::string deg,min,sec;
+  getline(ss,deg,' ');
+  getline(ss,min,' ');
+  getline(ss,sec);
+  char *end;
+  double d = strtod(deg.c_str(),&end);
+  double m = strtod(min.c_str(),&end);
+  double s = strtod(sec.c_str(),&end);  
+
+  double dec = fabs(d) + m/60. + s/3600.;
+  if(isNeg) dec = dec * -1.;
+
+  return dec;
+
+}
Index: /trunk/src/Utils.hh
===================================================================
--- /trunk/src/Utils.hh	(revision 1)
+++ /trunk/src/Utils.hh	(revision 1)
@@ -0,0 +1,74 @@
+#ifndef UTILS_HH_
+#define UTILS_HH_
+#include <sstream>
+#include <string>
+#include <vector>
+
+inline std::string removeLeadingBlanks(std::string s)
+{
+  int i=0;
+  while(s[i]==' '){
+    i++;
+  }
+  std::string newstring;
+  for(int j=i;j<s.size();j++) newstring += s[j];
+  return newstring;
+}
+
+inline std::string charToBinary(char c)
+{
+  std::stringstream ss;
+  int num=c;
+  if (num<0) num+=256;
+  int factor = 128;
+  for(int i=0;i<8;i++){
+    ss << num/factor;
+    num -= num/factor * factor;
+    factor /= 2;
+  }
+  return ss.str();
+}
+
+inline std::string binaryToString(std::vector<bool> v)
+{
+  int size = v.size();
+  int nbytes = (size-1)/8 + 1;
+  std::string output;
+  for(int byte=0;byte<nbytes;byte++){
+    int c=0;
+    for(int bit=0;bit<8;bit++){
+      int pt = byte*8+bit;
+      if(v[pt]) c += int(pow(2,7-bit));
+    }
+    //    std::cerr << int(c) << std::endl;
+    output += char(c);
+  }
+  return output;
+}
+
+inline unsigned int * binaryToInt(std::vector<bool> v)
+{
+  int size = v.size();
+  int nbytes = (size-1)/8 + 1;
+  unsigned int *output = new unsigned int[nbytes];
+  for(int byte=0;byte<nbytes;byte++){
+    int c=0;
+    for(int bit=0;bit<8;bit++){
+      int pt = byte*8+bit;
+      if(v[pt]) c += (unsigned int)pow(2,7-bit);
+    }
+    //    std::cerr << c << std::endl;
+    output[byte] = c;
+  }
+  return output;
+}
+
+inline std::string getPSRFITSdefn()
+{
+  std::string defn = getenv("PSRFITSDEFN");
+  return defn;
+}
+
+double dmsToDec(std::string input);  // in Utils.cc
+
+#endif /*UTILS_HH_*/
Index: unk/src/install_to_psr.sh
===================================================================
--- /trunk/src/install_to_psr.sh	(revision 486)
+++ 	(revision )
@@ -1,25 +1,0 @@
-#!/bin/tcsh 
-#
-# A script to install the files etc into the correct directory,
-# changing their suffixes so that it matches the PSR standards (ie. as
-# expected by the makefiles and so on).
-
-set PSRDEST="/pulsar/psr/pvo"
-
-echo Copying to $PSRDEST
-
-rm -rf $PSRDEST/Makefile $PSRDEST/*.C $PSRDEST/*.hh
-
-cp Makefile.psr           $PSRDEST/Makefile
-cp pvoconvert.cc      $PSRDEST/pvoconvert.C
-cp pvosummary.cc      $PSRDEST/pvosummary.C
-cp pvotapesummary.cc  $PSRDEST/pvotapesummary.C
-cp pvoconesearch.cc   $PSRDEST/pvoconesearch.C
-cp pvofixfilename.cc  $PSRDEST/pvofixfilename.C
-cp pvo-header.cc      $PSRDEST/pvo-header.C
-cp pvo-block.cc       $PSRDEST/pvo-block.C
-cp pvo-FITS.cc        $PSRDEST/pvo-FITS.C
-cp pvo-FITS-fileIO.cc $PSRDEST/pvo-FITS-fileIO.C
-cp pvo-utils.cc       $PSRDEST/pvo-utils.C
-cp pvo-metadata.cc    $PSRDEST/pvo-metadata.C
-cp *.hh               $PSRDEST
Index: unk/src/print_pm_data.cc
===================================================================
--- /trunk/src/print_pm_data.cc	(revision 486)
+++ 	(revision )
@@ -1,155 +1,0 @@
-#include <iostream>
-#include <sstream>
-#include <fstream>
-#include <iomanip>
-#include <vector>
-#include <string>
-using namespace std;
-enum FIELDS 
-{PROGRAM=0, VERSION, TAPENR, FILE_CNTR, BLK_CNTR, DATE, MJD, UT_STRT, LST_STRT, COORD_TYPE,
- RA_STRT, DEC_STRT, GL_STRT, GB_STRT, FEED_ANGLE, OBS_TIME, COMMENT, NFILTER, CHANBW, NCHAN, FREQ_CHAN1,
- SAMP_INT, SAMP_GRP, GRP_BLK, BLK_SEC, FDCNTRL, DATA, UT, LST, RA, DEC, GL, GB, TEL_ZEN,
- TEL_AZ, ATTEN, TPOWER, NBLK_READ, SCAN_RATEL, SCAN_RATEB, NBEAM, IBEAM, PNAME, OBS_FILEN, NBITS, DDM, NDDCH, MOVE,
- PNTERR, TREE, NSYS, TELID, PANGLE, SMP_BSW, CAL_CYCLE, RESERVE};
-
-const string fieldName[RESERVE+1] = 
-{"PROGRAM", "VERSION", "TAPENR", "FILE_CNTR", "BLK_CNTR", "DATE", "MJD", "UT_STRT", "LST_STRT", "COORD_TYPE",
-" RA_STRT", "DEC_STRT", "GL_STRT", "GB_STRT", "FEED_ANGLE", "OBS_TIME", "COMMENT", "NFILTER", "CHANBW", "NCHAN", "FREQ_CHAN1",
-" SAMP_INT", "SAMP_GRP", "GRP_BLK", "BLK_SEC", "FDCNTRL", "DATA", "UT", "LST", "RA", "DEC", "GL", "GB", "TEL_ZEN",
-" TEL_AZ", "ATTEN", "TPOWER", "NBLK_READ", "SCAN_RATEL", "SCAN_RATEB", "NBEAM", "IBEAM", "PNAME", "OBJS_FILEN", "NBITS", "DDM", "NDDCH", "MOVE",
-" PNTERR", "TREE", "NSYS", "TELID", "PANGLE", "SMP_BSW", "CAL_CYCLE", "RESERVE"};
-
-const int fieldDim[RESERVE+1]={1,1,1,1,1,1,1,1,1,1,
-			 1,1,1,1,1,1,1,1,2,2,2,
-			 2,2,1,1,1,2,1,1,1,1,1,1,1,
-			 1,4,20,1,1,1,1,1,1,1,2,1,2,1,
-			 1,1,1,1,1,1,1,1};
-
-const int fieldSize[RESERVE+1] = {6,4,6,4,8,8,8,16,12,2,
-			    16,16,8,8,8,8,64,2,8,4,12,
-			    12,4,8,8,2,1,16,12,16,16,8,8,8,
-			    8,4,4,8,8,8,4,4,16,16,2,8,4,2,
-			    6,2,2,10,8,8,4,22};
-
-int totalFieldSize[RESERVE+1];
-int fieldStartLoc[RESERVE+1];
-
-inline string getSub(string hdr, int field)
-{return hdr.substr(fieldStartLoc[field],totalFieldSize[field]);};
-			 
-
-int main(int argc, char * argv[])
-{
-  /**
-   *  This program simply reads a PM or PT tape data file block by block,
-   *  and prints out the header information.
-   *
-   *  What it does is print out a list of all header parameters for
-   *  the first block, giving the length in bytes of each of them, and
-   *  then for each block in the file, prints out a select set of
-   *  parameters.
-   * 
-   *  While it doesn't do anything with the data itself, it needs to
-   *  know how big the data section is and be able to read through it
-   *  correctly, otherwise the headers will be read incorrectly.
-   */
-
-  ifstream fin;
-  string filename;
-  if(argc==1){ 
-//     filename = "../data/pttape_test";
-    filename = "data/PM0001_001";
-  }
-  else if(argc==2){
-    filename = argv[1];
-  }
-  else{
-    cerr << "Either \"pm.x\" or \"pm.x filename\"...\n";
-    return(1);
-  }
-
-  const int HDR_LENGTH=640;     // length of the header in bytes
-  const int DAT_LENGTH=48*1024; // length of the data field in bytes
-
-  for(int i=0;i<=RESERVE;i++) totalFieldSize[i] = fieldDim[i] * fieldSize[i];
-  fieldStartLoc[0] = 0;
-  for(int i=1;i<=RESERVE;i++) fieldStartLoc[i] = fieldStartLoc[i-1] + totalFieldSize[i-1];
-
-  fin.open(filename.c_str(),ios::binary);
-  if(!fin.good()){
-    std::cerr << "Cannot find file " << filename << "!\nExiting...\n";
-    exit(1);
-  }
-  // define and read in the header
-  char *hdr = new char[4];
-  fin.read( hdr, 4*sizeof(char) );
-  hdr[3] = '\0';
-  unsigned char compstring[4] = {'P', 'M', 'D', 0};
-  if(strcmp((const char*)compstring,hdr)==0)
-    std::cerr << "Yes!\n";
-  else std::cerr << "No!\n";
-  fin.close();
-
-  fin.open(filename.c_str(),ios::binary);
-  // define and read in the header
-  hdr = new char[HDR_LENGTH];
-  fin.read( hdr, HDR_LENGTH*sizeof(char) );
-  string originalHDR(" ",HDR_LENGTH);
-  for(int c=0;c<HDR_LENGTH;c++) originalHDR[c] = hdr[c];
-
-  std::cerr << "Header field:\n" << hdr << std::endl;
-  fin.close();
-
-  std::cerr << "header length = " << originalHDR.size() << std::endl;
-
-  std::cout << "Header parsing:\n";
-  for(int i=0; i<=RESERVE; i++){
-    std::cout << setw(10) << fieldName[i] << ":\t";
-    std::cout << "[" << setw(3) << fieldStartLoc[i] << "]:\t";
-    if(getSub(originalHDR,i)[0]!=0) std::cout << getSub(originalHDR,i);
-    std::cout << "\n";
-  }
-
-
-  fin.open(filename.c_str(),ios::binary);
-  // now try and read in the data
-  char newone;
-  
-  string fullstring(" ",HDR_LENGTH), oldtime = "bob";
-  while(!fin.read( hdr, HDR_LENGTH*sizeof(char) ).eof()){
-//   for(int loop=0;loop<2;loop++){
-//     fin.read( hdr, HDR_LENGTH*sizeof(char) );
-
-    for(int c=0;c<HDR_LENGTH;c++) fullstring[c] = hdr[c];
-
-    float blk_sec = atof(getSub(fullstring,BLK_SEC).c_str());
-    int grp_blk = atoi( getSub(fullstring,GRP_BLK).c_str() );
-    stringstream ss;
-    ss.str(getSub(fullstring,NCHAN));
-    int nch[2];
-    ss >> nch[0] >> nch[1];
-
-    std::cerr << setw(totalFieldSize[BLK_CNTR]) << getSub(fullstring,BLK_CNTR)
-	      << " "
-	      << setw(totalFieldSize[DATE])     << getSub(fullstring,DATE)
-	      << setw(totalFieldSize[UT_STRT])  << getSub(fullstring,UT_STRT)
-	      << setw(totalFieldSize[UT])       << getSub(fullstring,UT)
-	      << setw(totalFieldSize[RA_STRT])  << getSub(fullstring,RA_STRT)
-	      << setw(totalFieldSize[DEC_STRT]) << getSub(fullstring,DEC_STRT)
-	      << setw(totalFieldSize[RA])       << getSub(fullstring,RA)
-	      << setw(totalFieldSize[DEC])      << getSub(fullstring,DEC)
-	      << setw(totalFieldSize[MOVE])     << getSub(fullstring,MOVE)
-	      << setw(totalFieldSize[IBEAM])    << getSub(fullstring,IBEAM)
-// 	      << " " << blk_sec / float(grp_blk) 
-// 	      << " " << 48.*1024.*8. / (nch[0] + nch[1])
-// 	      << " " << 48.*1024.*8. / (nch[0] + nch[1]) * blk_sec / float(grp_blk) 
-// 	      << " " << setw(totalFieldSize[MOVE]) << getSub(fullstring,MOVE)
-	      << std::endl;
-  
-    for(int i=0;i<DAT_LENGTH;i++) fin.read( &newone, sizeof(char) ); 
-
-   }
-
-
-}
-
Index: unk/src/print_s70_data.cc
===================================================================
--- /trunk/src/print_s70_data.cc	(revision 486)
+++ 	(revision )
@@ -1,180 +1,0 @@
-#include <iostream>
-#include <sstream>
-#include <fstream>
-#include <iomanip>
-#include <vector>
-#include <string>
-#include "pvo-utils.hh"
-using namespace PVO;
-
-// Taking the fields from sc_head.inc, which was copied from
-//   /pulsar/psr/cvshome/pulsar/soft_swin_old/soft_swin/search/util/sc_head.inc
-enum FIELDS 
-{SYNCH=0, VERSION, TAPENR, SCAN_CNTR, BLK_CNTR, DATE, MJD, UT_STRT, LST_STRT, COORD_TYPE,
- RA_STRT, DEC_STRT, GL_STRT, GB_STRT, SCAN_RATE, SCAN_LEN, COMMENT, NFILTER, CHANBW, NCHAN, FREQ_CHAN1,
- SAMP_INT, SAMP_GRP, GRP_BLK, BLK_SEC, DATA_ONE, UT, LST, RA, DEC, GL, GB, TEL_ZEN,
- TEL_AZ, STATUS, TPOWER, NBLK_READ, SCAN_RATEL, SCAN_RATEB, BYTE_GRP, IBEAM, PSRNAME, DATA_TWO, OBS_FILEN, NBITS, DDM, NDDCH, MOVE, PNTERR, TREE, NSYS, TELID, NBEAM, RESERVE};
-
-const std::string fieldName[RESERVE+1] = 
-{"SYNCH", "VERSION", "TAPENR", "SCAN_CNTR", "BLK_CNTR", "DATE", "MJD", "UT_STRT", "LST_STRT", "COORD_TYPE",
- "RA_STRT", "DEC_STRT", "GL_STRT", "GB_STRT", "SCAN_RATE", "SCAN_LEN", "COMMENT", "NFILTER", "CHANBW", "NCHAN", "FREQ_CHAN1",
- "SAMP_INT", "SAMP_GRP", "GRP_BLK", "BLK_SEC", "DATA_ONE", "UT", "LST", "RA", "DEC", "GL", "GB", "TEL_ZEN",
- "TEL_AZ", "STATUS", "TPOWER", "NBLK_READ", "SCAN_RATEL", "SCAN_RATEB", "BYTE_GRP", "IBEAM", "PSRNAME", "DATA_TWO", "OBS_FILEN", "NBITS", "DDM", "NDDCH", "MOVE", "PNTERR", "TREE", "NSYS", "TELID", "NBEAM", "RESERVE"};
-
-const int fieldDim[RESERVE+1]={1,1,1,1,1,1,1,1,1,1,
-			       1,1,1,1,1,1,1,1,2,2,2,
-			       2,2,1,1,1,1,1,1,1,1,1,1,
-			       1,4,8,1,1,1,1,1,1,1,1,2,1,2,1,1,1,1,1,1,1};
-
-const int fieldSize[RESERVE+1] = {8,4,4,4,8,8,8,16,12,2,
-				  16,16,8,8,8,8,64,2,8,4,12,
-				  12,4,8,8,4,16,12,16,16,8,8,8,
-				  8,8,8,8,8,8,4,4,12,4,16,2,8,4,2,6,2,2,10,4,38};
-
-int totalFieldSize[RESERVE+1];
-int fieldStartLoc[RESERVE+1];
-
-inline std::string getSub(std::string hdr, int field){
-  return hdr.substr(fieldStartLoc[field],totalFieldSize[field]);
-};
-std::string extractFieldID(std::string header);
-			 
-
-int main(int argc, char * argv[])
-{
-  /**
-   *  This program simply reads a S70 tape data file block by block,
-   *  and prints out the header information.
-   *
-   *  What it does is print out a list of all header parameters for
-   *  the first block, giving the length in bytes of each of them, and
-   *  then for each block in the file, prints out a select set of
-   *  parameters.
-   * 
-   *  While it doesn't do anything with the data itself, it needs to
-   *  know how big the data section is and be able to read through it
-   *  correctly, otherwise the headers will be read incorrectly.
-   */
-
-  std::ifstream fin;
-  std::string filename;
-  if(argc==1){
-    filename = "data/s70_tape_test_S181_S18101.dat";
-  }
-  else if(argc>=2){
-    filename = argv[1];
-  }
-  else{
-    std::cerr << "Either \"s70.x\" or \"s70.x filename\"...\n";
-    return(1);
-  }
-
-  const int HDR_LENGTH=640;     // length of the header in bytes
-  const int DAT_LENGTH=48*1024; // length of the data field in bytes
-
-  for(int i=0;i<=RESERVE;i++) totalFieldSize[i] = fieldDim[i] * fieldSize[i];
-  fieldStartLoc[0] = 0;
-  for(int i=1;i<=RESERVE;i++) fieldStartLoc[i] = fieldStartLoc[i-1] + totalFieldSize[i-1];
-
-  fin.open(filename.c_str(),std::ios::binary);
-  if(!fin.good()){
-    std::cerr << "Cannot find file " << filename << "!\nExiting...\n";
-    exit(1);
-  }
-  // define and read in the header
-  char *hdr = new char[5];
-  fin.read( hdr, 5*sizeof(char) );
-  hdr[4] = '\0';
-  unsigned char compstring[5] = {182, 'm', 'm', 219, 0};
-  if(strcmp((const char*)compstring,hdr)==0)
-    std::cout << "Yes!\n";
-  else std::cout << "No!\n";
-  fin.close();
-
-  fin.open(filename.c_str(),std::ios::binary);
-  // define and read in the header
-  hdr = new char[HDR_LENGTH];
-  fin.read( hdr, HDR_LENGTH*sizeof(char) );
-  std::string originalHDR(" ",HDR_LENGTH);
-  for(int c=0;c<HDR_LENGTH;c++) originalHDR[c] = hdr[c];
-
-  std::cout << "Header field:\n" << hdr << std::endl;
-  fin.close();
-
-  std::cout << "header length = " << originalHDR.size() << std::endl;
-
-  std::cout << "Header parsing:\n";
-  for(int i=0; i<=RESERVE; i++){
-    std::cout << std::setw(10) << fieldName[i] << " ";
-    std::cout << "[" << std::setw(3) << fieldStartLoc[i] << "]:\t";
-    if(getSub(originalHDR,i)[0]!=0) std::cout << getSub(originalHDR,i);
-    std::cout << "\n";
-  }
-
-
-  fin.open(filename.c_str(),std::ios::binary);
-  // now try and read in the data
-  char newone;
-  
-  std::string fullstring(" ",HDR_LENGTH), oldtime = "bob",time,oldmove="44",move;
-
-  std::cout.setf(std::ios::fixed);
-
-  while(!fin.read( hdr, HDR_LENGTH*sizeof(char) ).eof()){
-    for(int c=0;c<HDR_LENGTH;c++) fullstring[c] = hdr[c];
-
-    float blk_sec = atof(getSub(fullstring,BLK_SEC).c_str());
-    int grp_blk = atoi( getSub(fullstring,GRP_BLK).c_str() );
-    float samp_int = atof( getSub(fullstring,SAMP_INT).c_str() );
-    int samp_grp = atoi( getSub(fullstring,SAMP_GRP).c_str() );
-    std::stringstream ss;
-    ss.str(getSub(fullstring,NCHAN));
-    int nch[2];
-    ss >> nch[0] >> nch[1];
-    move = atoi( getSub(fullstring,MOVE).c_str() );
-
-    std::string newUT = decToDMS( dmsToDec(getSub(fullstring,UT_STRT)) + 
-			     (atoi(getSub(fullstring,BLK_CNTR).c_str())-1)
-			     *blk_sec/3600. );
-
-    std::cout << std::setw(totalFieldSize[BLK_CNTR]) << getSub(fullstring,BLK_CNTR)
-	      << " "
-      // 	 << setw(totalFieldSize[COMMENT])  << getSub(fullstring,COMMENT)
-	      << extractFieldID(fullstring) << " "
-	      << std::setw(totalFieldSize[DATE])     << getSub(fullstring,DATE)
-	      << std::setw(totalFieldSize[UT_STRT])  << getSub(fullstring,UT_STRT)
-	      << std::setw(totalFieldSize[UT])       << getSub(fullstring,UT)
-      // 	 << setw(12)                       << newUT
-      // 	 << setw(10) << setprecision(6)
-      // 	 << (dmsToDec(getSub(fullstring,UT).c_str()) - dmsToDec(newUT))*3600.
-	      << std::setw(totalFieldSize[LST])      << getSub(fullstring,LST)
-	      << std::setw(totalFieldSize[RA_STRT])  << getSub(fullstring,RA_STRT)
-	      << std::setw(totalFieldSize[DEC_STRT]) << getSub(fullstring,DEC_STRT)
-	      << std::setw(totalFieldSize[RA])       << getSub(fullstring,RA)
-	      << std::setw(totalFieldSize[DEC])      << getSub(fullstring,DEC)
-	      << std::setw(totalFieldSize[MOVE])     << getSub(fullstring,MOVE)
-	      << std::setw(totalFieldSize[SCAN_LEN]) << getSub(fullstring,SCAN_LEN)
-      // 	 << setw(totalFieldSize[IBEAM])    << getSub(fullstring,IBEAM)
-      // 	 << setw(totalFieldSize[BLK_SEC])  << getSub(fullstring,BLK_SEC)
-      // 	 << setw(totalFieldSize[GRP_BLK])  << getSub(fullstring,GRP_BLK)
-      // 	 << setw(totalFieldSize[SAMP_INT]) << getSub(fullstring,SAMP_INT)
-      // 	 << setw(totalFieldSize[SAMP_GRP]) << getSub(fullstring,SAMP_GRP)
-	      << std::endl;
-    
-    for(int i=0;i<DAT_LENGTH;i++) fin.read( &newone, sizeof(char) ); 
-    
-  }
-
-
-}
-
-
-std::string extractFieldID(std::string header)
-{
-  std::stringstream ss;
-  ss.str(getSub(header,COMMENT));
-  std::string temp,field="";
-  do{ ss >> temp; } while( temp[0]!='G' && !ss.eof());
-  if(temp[0]=='G') field=temp;
-  return field;
-}
Index: unk/src/pvo-FITS-fileIO.cc
===================================================================
--- /trunk/src/pvo-FITS-fileIO.cc	(revision 486)
+++ 	(revision )
@@ -1,672 +1,0 @@
-#include <iostream>
-#include <sstream>
-#include <iomanip>
-#include <string>
-#include <time.h>
-#include <math.h>
-#include <fitsio.h>
-#include "pvo.hh"
-#include "pvo-FITS.hh"
-#include "pvo-utils.hh"
-#include "pvo-block.hh"
-#include "pvo-header.hh"
-
-using namespace PVO::Block;
-using namespace PVO::Header;
-
-namespace PVO
-{
-
-  namespace FITS
-  {
-
-    void PSRFits::fixPSRFITS()
-    {
-      /**
-       *  Corrects known errors that exist in the PSRFITS definition:
-       *  <ul><li> Set the TFORM keyword for the data column in the
-       *             SUBINT table
-       *      <li> Remove the unwanted Binary Tables.
-       *  </ul>
-       */
-      if(this->gotoSubint()){
-	PVOError("PSRFits::fixPSRFITS","Could not go to the SUBINT table.\n");
-	return;
-      }
-    
-      int status=0;
-      char cval[9];
-      strcpy(cval,"16X");
-      fits_update_key(this->fptr, TSTRING, "TFORM18", cval, NULL, &status);
-      if(status) this->FITSError("PSRFits::fixPSRFITS 1", status);
-
-      if((status=this->deleteTable("BANDPASS")))
-	this->FITSError("PSRFits::deleteTable(BANDPASS)", status);
-      if((status=this->deleteTable("COHDDISP")))
-	this->FITSError("PSRFits::deleteTable(COHDDISP)", status);
-      if((status=this->deleteTable("PSREPHEM")))
-	this->FITSError("PSRFits::deleteTable(PSREPHEM)", status);
-      if((status=this->deleteTable("POLYCO")))
-	this->FITSError("PSRFits::deleteTable(POLYCO)", status);
-      if((status=this->deleteTable("T2PREDICT")))
-	this->FITSError("PSRFits::deleteTable(T2PREDICT)", status);
-      if((status=this->deleteTable("FLUX_CAL")))
-	this->FITSError("PSRFits::deleteTable(FLUX_CAL)", status);
-      if((status=this->deleteTable("CAL_POLN")))
-	this->FITSError("PSRFits::deleteTable(CAL_POLN)", status);
-      if((status=this->deleteTable("FEEDPAR")))
-	this->FITSError("PSRFits::deleteTable(FEEDPAR)", status);
-      if((status=this->deleteTable("DIG_STAT")))
-	this->FITSError("PSRFits::deleteTable(DIG_STAT)", status);
-      if((status=this->deleteTable("DIG_CNTS")))
-	this->FITSError("PSRFits::deleteTable(DIG_CNTS)", status);
-
-      this->gotoPHU();
-    }
-
-    //--------------------------------------------------------------------------
-
-    int PSRFits::initialise(DataBlock &block)
-    {
-      /**
-       * Initialises a fits file for use in the conversion program. The
-       * order of business is as follows: 
-       *
-       * <ul>
-       *   <li> When new:
-       *   <ul><li> Set the initial date & time (UT) for the file. 
-       *       <li> If a new file is beginning, and the time has changed
-       *       and is smaller than the existing time, we need to
-       *       increment the date. This may be the case if we are
-       *       working through a large tape file and the blocks go past
-       *       midnight. 
-       *   </ul>
-       *   <li> Set the beam used in the file.
-       *   <li> Define the FITS file name.
-       *   <li> Set the starting block value.
-       *   <li> If new, test whether file exists.
-       *   <li> Open the fits file.
-       *   <li> If new:
-       *   <ul><li> Write the PHU headers using writePHU();
-       *       <li> Setup and write the SUBINT header with setupSubint(). 
-       *   </ul>
-       * </ul>
-       * \param block The block used to get the header information.
-       */
-
-      std::string newUT,date,nullStr="";
-
-      if(this->newFile){
-
-	this->numSamples = 0; // Initialise the number of samples.
-
-	this->UT_input = block.getKeyword<std::string>(UT_STRT);
-	newUT = block.getKeyword<std::string>(UT);
-	date   = block.getKeyword<std::string>(DATE);
-	
-	// Test whether we have gone over midnight.  
-	// need the extra 60 seconds in case the UT_input and UT are
-	// not precisely aligned.
-	if(dmsToDec(this->UT_input) > (dmsToDec(newUT)+60./3600.) ) 
-	  date = addDay(date);
-
- 	this->setUT(newUT);
-	this->setDate(date);
-      }
-
-      this->setBeam(block.getKeyword<int>(IBEAM));
-
-      if(block.getSurveyType()==S70) 
-	this->setInitialBlock(block.getKeyword<int>(BLK_CNTR));
-      else 
-	this->setInitialBlock(1);
-
-      this->setFITSname(block);
-
-      if(this->writingData){
-
-	if(this->newFile && this->fileExists() && !this->clobber){
-	  std::stringstream errmsg;
-	  errmsg << "\aThe file "<< this->getFITSname() 
-		 << " already exists.\n"
-		 << "Don't want to overwrite, so exiting...\n";
-	  if(this->verbose) PVOError("FITS initialise",errmsg.str());
-	  return FAILURE;
-	}
-
-	if(this->openFile()) {
-	  if(this->verbose) 
-	    std::cerr << "\aCannot open file "<< this->getFITSname()
-		      << ".\nExiting...\n";
-	  return FAILURE;
-	}
-
-	if(this->newFile){
-      
-	  this->writeHistoryCommand(block);
-  
-	  this->writePHU(block);
-
-	  this->setupSubint(block);
-    
-	}
-
-      }
-      else{ // if we're not writing data.
-	if(this->newFile){
-	  std::cout << this->FITSname;
-	  if(this->fileExists()) std::cout << " --> File Exists!";
-	  std::cout << "\n";
-	}
-      }
-
-      this->newFile = false;
-
-      return SUCCESS;
-
-    }
-    //--------------------------------------------------------------------------
-
-    void PSRFits::setupSubint(DataBlock &block)
-    {
-      /**
-       *  A function to set up the subintegration binary table
-       *  extension.  This defines the necessary keywords, as well as
-       *  the DAT_... arrays to go in the columns (as these will be the
-       *  same for all rows of the subintegration table -- at least as
-       *  far as the conversion program goes.)
-       *
-       *  It then calls the Subint::writeKeywords() function to write
-       *  the header keywords to the table.
-       *
-       * \param block The block containing the header information.
-       */
-    
-      this->subintTable.tsamp = block.getKeyword<float>(SAMP_INT,0)/1000.;
-      this->subintTable.nbits = block.getKeyword<int>(NBITS,0);
-      this->subintTable.nbin = block.Survey().getNbin(); 
-      this->subintTable.nchan = block.getKeyword<int>(NCHAN);
-      this->subintTable.chan_bw = block.getKeyword<float>(CHANBW);
-      this->subintTable.nbin_prd = block.Survey().getNbin_prd();
-      this->subintTable.phs_offs = block.Survey().getPhs_offs();
-      this->subintTable.nsuboffs = block.Survey().getNsuboffs();
-      this->subintTable.npol = block.Survey().getNPol();
-      this->subintTable.pol_type = block.Survey().getPolType();
-      this->subintTable.scale = block.Survey().getScale();
-      this->subintTable.nsblk = block.getKeyword<int>(SAMP_GRP,0) * 
-	block.getKeyword<int>(GRP_BLK);
-
-      // define the DAT_FREQ array;
-      int numChan = this->subintTable.nchan;
-      this->subintTable.dat_freq = new float[numChan];
-      this->subintTable.dat_freq[0] = block.getKeyword<float>(FREQ_CHAN1);
-      for(int i=1;i<this->subintTable.nchan;i++) 
-	this->subintTable.dat_freq[i] = 
-	  this->subintTable.dat_freq[i-1] + this->subintTable.chan_bw;
-      /*
-      // This is to switch the order of the frequencies
-      this->subintTable.dat_freq[numChan-1] = block.getKeyword<float>(FREQ_CHAN1);
-      for(int i=numChan-1;i>0;i--) 
-      this->subintTable.dat_freq[i-1] = 
-      this->subintTable.dat_freq[i] + deltaFreq;
-      */
-
-      // define the DAT_WTS array;
-      this->subintTable.dat_wts = new float[this->subintTable.nchan];
-      for(int i=0;i<this->subintTable.nchan;i++)
-	this->subintTable.dat_wts[i] = 1.;
-
-      // define the DAT_OFFS array;
-      this->subintTable.dat_offs = new float[this->subintTable.nchan];
-      for(int i=0;i<this->subintTable.nchan;i++)
-	this->subintTable.dat_offs[i] = 0.;
-
-      // define the DAT_SCL array;
-      this->subintTable.dat_scl = new float[this->subintTable.nchan];
-      for(int i=0;i<this->subintTable.nchan;i++)
-	this->subintTable.dat_scl[i] = 1.;
-    
-    
-      this->subintTable.setAllocatedFlag(true);
-
-      // now write the keywords to the subint table
-      if(this->gotoSubint()) 
-	PVOError("PSRFits::initialise","Could not go to the SUBINT table.\n");
-      else{
-	int status = this->subintTable.writeKeywords(this->fptr);
-	if(status) this->FITSError("Subint::writeKeywords",status);
-      }
-
-    
-    }
-
-    //-----------------------------------------------------------------------
-
-    int Subint::writeKeywords(fitsfile *fptr)
-    {
-      /**
-       *  A special function in the Subint class to write all the header
-       *  keywords necessary for the subintegration binary table
-       *  extension. This should only need to be done once per file.
-       *
-       *  The keywords are stored as private members of Subint, and need
-       *  to be defined beforehand.
-       *
-       *  \param fptr The fitsfile pointer corresponding to the file to
-       *  be written to.
-       */
-
-      int status=0;
-      fits_update_key(fptr,TSTRING,"INT_TYPE", 
-		      (char *)this->int_type.c_str(), NULL, &status);
-      if(status) return status;
-      else{
-	
-	status=0;
-	fits_update_key(fptr,TSTRING,"INT_UNIT",
-			(char *)this->int_unit.c_str(),NULL,&status);
-	status=0;
-	fits_update_key(fptr,TSTRING,"SCALE",(char *)this->scale.c_str(),NULL,&status);
-	status=0;
-	fits_update_key(fptr,TINT,"NPOL",&this->npol,NULL,&status);
-	status=0;
-	fits_update_key(fptr,TSTRING,"POL_TYPE",(char *)this->pol_type.c_str(),NULL,&status);
-	status=0;
-	fits_update_key(fptr,TFLOAT,"TBIN",&this->tsamp,NULL,&status);    
-	status=0;
-	fits_update_key(fptr,TINT,"NBIN",&this->nbin,NULL,&status);
-	status=0;
-	fits_update_key(fptr,TINT,"NBIN_PRD",&this->nbin_prd,NULL,&status);
-	status=0;
-	fits_update_key(fptr,TINT,"PHS_OFFS",&this->phs_offs,NULL,&status);
-	status=0;
-	fits_update_key(fptr,TINT,"NBITS",&this->nbits,NULL,&status);    
-	status=0;
-	fits_update_key(fptr,TINT,"NSUBOFFS",&this->nsuboffs,NULL,&status);
-	status=0;
-	fits_update_key(fptr,TINT,"NCHAN",&this->nchan,NULL,&status);
-	status=0;
-	fits_update_key(fptr,TFLOAT,"CHAN_BW",&this->chan_bw,NULL,&status);
-	status=0;
-	fits_update_key(fptr,TINT,"NCHOFFS",&this->nchoffs,NULL,&status);
-	status=0;
-	fits_update_key(fptr,TINT,"NSBLK",&this->nsblk,NULL,&status);
-	status=0;
-	int colnum=0;
-	fits_get_colnum(fptr, CASEINSEN, "DATA", &colnum, &status);
-	status=0;
-	fits_modify_vector_len (fptr, colnum, this->getDataSize(), &status);
-
-	// delete the existing "TDIM19 = (*,*,*,*)" and write the new one.
-	status=0;
-	fits_delete_key(fptr, "TDIM19", &status);
-	int naxis=4;
-	long naxes[4];
-	naxes[0] = this->nbits;
-	naxes[1] = this->nchan;
-	naxes[2] = this->npol;
-	naxes[3] = this->nsblk;
-	status=0;
-	fits_write_tdim(fptr, colnum, naxis, naxes, &status);
-
-      }
-      return 0;
-    }
-    //--------------------------------------------------------------------------
-
-    void PSRFits::writeSubintRow(DataBlock &block)
-    {
-      /**
-       * This function writes an entire new row in the SUBINT table extension.
-       * The procedure is as follows:
-       * <ul> <li> Move to the subint table.
-       *      <li> Start a new row with startNewSubintRow()
-       *      <li> Write the single-valued columns with writeColumnValue()
-       *      <li> Write the multi-valued DAT_... columns
-       *      <li> Write the data.
-       *      <li> Increment the number of samples.
-       * </ul>
-       * If PSRFits::writingData is false, we are not writing data to
-       * the file, and so only the incrementing is done.
-       * \param block The block containing the header info & the data.
-       */
-
-      // First, increment the number of samples
-      this->numSamples += (block.getKeyword<int>(GRP_BLK) * 
-			   block.getKeyword<int>(SAMP_GRP) );
-
-      // Then only write data if the correct flag is set.
-      if(this->areWritingData()){
-
-	this->gotoSubint();
-	this->startNewSubintRow(); 
-
-	float tsubint = block.getKeyword<float>(BLK_SEC);
-	double off_sub;
-    
-	off_sub = 0.5 * 
-	  (2.*(block.getKeyword<int>(BLK_CNTR)-this->blk_initial)+1)
-	  * block.getKeyword<double>(BLK_SEC);
-
-	double lst_sub  = dmsToDec(block.getKeyword<std::string>(LST));
-	double ra_sub   = dmsToDec(block.getKeyword<std::string>(RA))*15.;
-	double dec_sub  = dmsToDec(block.getKeyword<std::string>(DEC));
-	double glon_sub = block.getKeyword<double>(GL);
-	double glat_sub = block.getKeyword<double>(GB);
-	float  fd_ang   = block.getKeyword<float>(FEED_ANGLE);
-	float  par_ang  = block.getKeyword<float>(PANGLE);
-	float  pos_ang  = remainderf(par_ang + fd_ang, 360.);
-	float  tel_az   = block.getKeyword<float>(TEL_AZ);
-	float  tel_zen  = block.getKeyword<float>(TEL_ZEN);
-    
-	this->writeColumnValue("TSUBINT",  tsubint);
-	this->writeColumnValue("OFFS_SUB", off_sub);
-	this->writeColumnValue("LST_SUB",  lst_sub);
-	this->writeColumnValue("RA_SUB",   ra_sub);
-	this->writeColumnValue("DEC_SUB",  dec_sub);
-	this->writeColumnValue("GLON_SUB", glon_sub);
-	this->writeColumnValue("GLAT_SUB", glat_sub);
-	this->writeColumnValue("FD_ANG",   fd_ang);
-	this->writeColumnValue("POS_ANG",  pos_ang);
-	this->writeColumnValue("PAR_ANG",  par_ang);
-	this->writeColumnValue("TEL_AZ",   tel_az);
-	this->writeColumnValue("TEL_ZEN",  tel_zen);
-
-	/////////////////////////////////////
-
-	long nrows = this->getNumRows();
-	int colnum = this->getColnum("DAT_FREQ");
-	int status=0;
-	fits_modify_vector_len (this->fptr, colnum, 
-				this->subintTable.nchan, &status);
-	if(status) this->FITSError("PSRFits::writeSubintRow", status);
-	status=0;
-	fits_write_col(this->fptr, TFLOAT, colnum, nrows, 1, 
-		       this->subintTable.nchan, this->subintTable.dat_freq, 
-		       &status);
-	if(status) this->FITSError("PSRFits::writeSubintRow", status);
-
-	colnum = this->getColnum("DAT_WTS");
-	status=0;
-	fits_modify_vector_len (this->fptr, colnum, 
-				this->subintTable.nchan, &status);
-	if(status) this->FITSError("PSRFits::writeSubintRow", status);
-	status=0;
-	fits_write_col(this->fptr, TFLOAT, colnum, nrows, 1, 
-		       this->subintTable.nchan, this->subintTable.dat_wts, 
-		       &status);
-	if(status) this->FITSError("PSRFits::writeSubintRow", status);
-
-	colnum = this->getColnum("DAT_OFFS");
-	status=0;
-	fits_modify_vector_len (this->fptr, colnum, 
-				this->subintTable.nchan, &status);
-	if(status) this->FITSError("PSRFits::writeSubintRow", status);
-	status=0;
-	fits_write_col(this->fptr, TFLOAT, colnum, nrows, 1, 
-		       this->subintTable.nchan, this->subintTable.dat_offs, 
-		       &status);
-	if(status) this->FITSError("PSRFits::writeSubintRow", status);
-
-	colnum = this->getColnum("DAT_SCL");
-	status=0;
-	fits_modify_vector_len (this->fptr, colnum, 
-				this->subintTable.nchan, &status);
-	if(status) this->FITSError("PSRFits::writeSubintRow", status);
-	status=0;
-	fits_write_col(this->fptr, TFLOAT, colnum, nrows, 1, 
-		       this->subintTable.nchan, this->subintTable.dat_scl, 
-		       &status);
-	if(status) this->FITSError("PSRFits::writeSubintRow", status);
-
-	colnum = this->getColnum("DATA");
-	status=0;
-	fits_write_col(this->fptr, TBYTE, colnum, nrows, 1, this->subintTable.getDataSizeBytes(), block.getData(), &status);
-	if(status) this->FITSError("PSRFits::writeDataArray 4", status);
-
-      } // end of if(areWritingData()) loop
-
-    }
-    //--------------------------------------------------------------------------
-
-    void PSRFits::writePHU(DataBlock &block)
-    {
-      /**
-       *   Writes the header information contained in the DataBlock block
-       *    to the primary header unit.
-       *   At the end the current header unit will be the PHU.
-       */
-      this->gotoPHU();
-
-      char *todaysdate     = new char[25];
-      int timeref,status=0;
-      fits_get_system_time(todaysdate, &timeref, &status);
-      if(status) this->FITSError("PSRFits::writePHU", status);
-      std::string projid   = block.getSurveyName();
-      std::string telescop = block.getKeyword<std::string>(TELID);
-      if((deblank(telescop)=="")&&(block.getSurveyType()==S70)) 
-	telescop           = "PARKES";
-      double ant_x         = block.Survey().getAntX();
-      double ant_y         = block.Survey().getAntY();
-      double ant_z         = block.Survey().getAntZ();
-      int nrcvr            = block.Survey().getNrcvr();
-      std::string frontend = block.Survey().getFrontend();
-      std::string fd_poln  = block.Survey().getFd_poln();
-      int fd_hand          = block.Survey().getFd_hand();
-      float fd_sang        = block.Survey().getFd_sang();
-      float fd_xyph        = block.Survey().getFd_xyph();
-      std::string backend  = block.Survey().getBackend();
-      std::string beconfig = block.Survey().getBeconfig();
-      int be_phase         = block.Survey().getBe_phase();
-      int be_dcc           = block.Survey().getBe_dcc();
-      double tcycle        = block.Survey().getTcycle();
-      //      int nrcvr            = block.getKeyword<int>(NFILTER);
-      std::string obs_mode = block.getObs_mode();
-
-      std::string date_obs = 
-	makeDateObs(deblank(block.getKeyword<std::string>(DATE)),
-		    deblank(block.getKeyword<std::string>(UT))   );
-
-      double f0            = block.getKeyword<double>(FREQ_CHAN1);
-      double obsbw         = block.getKeyword<double>(CHANBW);
-      double obsnchan      = block.getKeyword<double>(NCHAN);
-      float obsfreq        = f0 + ((obsnchan-1)/2.) * obsbw;
-
-
-      std::string src_name;
-      if(block.getSurveyType()==S70) src_name = block.getFieldID();
-      else src_name = deblank(block.getKeyword<std::string>(PSRNAME));
-
-      std::vector<std::string> commentfields  = 
-	block.getFullKeyword<std::string>(COMMENT);
-      std::string comment;
-      if(commentfields.size()>0){
-	comment = commentfields[0];
-	for(int j=1;j<commentfields.size();j++) 
-	  comment += " " + commentfields[j];
-      }
-      comment = deblank(comment);
-      
-      std::string coord_md = block.getCoordMode();
-      std::string eq_str   = block.getEquinox();
-      float equinox        = 0.;
-      if(eq_str==Block::eq_j2000)       equinox = Block::eq_2000;
-      else if(eq_str==Block::eq_b1950)  equinox = Block::eq_1950;
-      std::string ra       = deblank(block.getKeyword<std::string>(RA));
-      std::string dec      = deblank(block.getKeyword<std::string>(DEC));
-      float bmaj           = block.Survey().getBmaj();
-      float bmin           = block.Survey().getBmin();
-      float bpa            = block.Survey().getBpa();
-      std::string stt_crd1 = deblank(block.getKeyword<std::string>(RA));
-      std::string stt_crd2 = deblank(block.getKeyword<std::string>(DEC));
-      std::string trk_mode = block.Survey().getTrk_mode();
-      std::string stp_crd1 = deblank(block.getKeyword<std::string>(RA));
-      std::string stp_crd2 = deblank(block.getKeyword<std::string>(DEC));
-      //       float scanlen        = block.Survey().getScanlen();
-      //      float scanlen        = block.getKeyword<float>(SCAN_LEN);
-      std::string fd_mode  = block.Survey().getFd_mode();
-      float fa_req         = block.getKeyword<float>(FEED_ANGLE);
-      std::string cal_mode = block.Survey().getCal_mode();
-      float cal_freq       = block.Survey().getCal_freq();
-      float cal_dcyc       = block.Survey().getCal_dcyc();
-      float cal_phs        = block.Survey().getCal_phs();
-      long stt_imjd        = block.getKeyword<int>(MJD);
-      double start_time    = dmsToDec(deblank(block.getKeyword<std::string>(UT)))*3600.;
-      long stt_smjd        = long(floor(start_time));
-      double stt_offs      = start_time - floor(start_time);
-      double stt_lst       = dmsToDec(block.getKeyword<std::string>(LST))*3600.;
-
-      this->updateKeyword("DATE",     todaysdate);
-      this->updateKeyword("PROJID",   projid);
-      this->updateKeyword("TELESCOP", telescop);
-      this->updateKeyword("ANT_X",    ant_x);          
-      this->updateKeyword("ANT_Y",    ant_y);        
-      this->updateKeyword("ANT_Z",    ant_z);        
-      this->updateKeyword("NRCVR",    nrcvr);        
-      this->updateKeyword("FRONTEND", frontend);
-      this->updateKeyword("FD_POLN",  fd_poln);
-      this->updateKeyword("FD_HAND",  fd_hand);
-      this->updateKeyword("FD_SANG",  fd_sang);
-      this->updateKeyword("FD_XYPH",  fd_xyph);
-      this->updateKeyword("BACKEND",  backend);
-      this->updateKeyword("BECONFIG", beconfig);
-      this->updateKeyword("BE_PHASE", be_phase);
-      this->updateKeyword("BE_DCC",   be_dcc);
-      this->updateKeyword("TCYCLE",   tcycle);
-      this->updateKeyword("OBS_MODE", obs_mode);
-      this->updateKeyword("DATE-OBS", date_obs);
-      this->updateKeyword("OBSFREQ",  obsfreq);
-      this->updateKeyword("OBSBW",    obsbw);
-      this->updateKeyword("OBSNCHAN", obsnchan);
-      this->updateKeyword("SRC_NAME", src_name);
-      this->updateKeyword("COORD_MD", coord_md);
-      if(equinox>0.)
-	this->updateKeyword("EQUINOX",  equinox);
-      this->updateKeyword("RA",       ra);
-      this->updateKeyword("DEC",      dec);
-      this->updateKeyword("BMAJ",     bmaj);
-      this->updateKeyword("BMIN",     bmin);
-      this->updateKeyword("BPA",      bpa);
-      this->updateKeyword("STT_CRD1", stt_crd1);
-      this->updateKeyword("STT_CRD2", stt_crd2);
-      this->updateKeyword("TRK_MODE", trk_mode);
-      this->updateKeyword("STP_CRD1", stp_crd1);
-      this->updateKeyword("STP_CRD2", stp_crd2);
-      //       this->updateKeyword("SCANLEN",  scanlen);
-      this->updateKeyword("FD_MODE",  fd_mode);
-      this->updateKeyword("FA_REQ",   fa_req);
-      this->updateKeyword("CAL_MODE", cal_mode);
-      this->updateKeyword("CAL_FREQ", cal_freq);
-      this->updateKeyword("CAL_DCYC", cal_dcyc);
-      this->updateKeyword("CAL_PHS ", cal_phs);
-      this->updateKeyword("STT_IMJD", stt_imjd);
-      this->updateKeyword("STT_SMJD", stt_smjd);
-      this->updateKeyword("STT_OFFS", stt_offs);
-      this->updateKeyword("STT_LST ", stt_lst);
-
-      //    this->addNewKeywords(block);
-
-      //       if(PVO::addCommentString){
-      // 	fits_write_comment(this->fptr, 
-      // 			   "The following line is the COMMENT string from the original data file.", &status);
-      // 	fits_write_comment(this->fptr, (char *)comment.c_str(), &status);
-      // //      this->updateKeyword("OBSNOTES", comment);
-      //       }
-
-      delete [] todaysdate;
-
-    }
-    //-----------------------------------------------------------------------
-  
-    void PSRFits::addNewKeywords(DataBlock &block)
-    {
-      /**
-       *   Adds new keywords to the PHU that have not yet been added into the 
-       *   PSRFITS definition.
-       *   Need to be in the PHU before calling this function.
-       *
-       *   NOTHING LEFT TO DO HERE.
-       *  \deprecated
-       */
-      return;
-    }
-    //-----------------------------------------------------------------------
-
-    void PSRFits::writeHistoryCommand(DataBlock &block)
-    {
-      /**
-       * Write processing history information to the HISTORY binary table 
-       * extension. This is just a row of today's date and what was entered
-       * in the command line.
-       */
-    
-      this->gotoHistory();
-
-      char *todaysdate     = new char[25];
-      int timeref,status=0;
-      fits_get_system_time(todaysdate, &timeref, &status);
-      if(status) this->FITSError("PSRFits::writeHistoryCommand", status);
-
-      //    std::string historyMessage;
-      //   historyMessage = "PVOCONVERT command: " + this->commandLine;
-
-      this->startNewRow(); 
-      this->writeColumnValue("DATE_PRO", todaysdate);
-      this->writeColumnValue("PROC_CMD", (char *)this->commandLine.c_str());
-
-      this->writeColumnValue("TBIN", block.getKeyword<double>(SAMP_INT)/1000.);
-      double f0            = block.getKeyword<double>(FREQ_CHAN1);
-      double bw            = block.getKeyword<double>(CHANBW);
-      double nc            = block.getKeyword<double>(NCHAN);
-      float obsfreq        = f0 + ((nc-1)/2.) * bw;
-      this->writeColumnValue("CTR_FREQ", obsfreq);
-      this->writeColumnValue("NCHAN", nc);
-      this->writeColumnValue("CHAN_BW", bw);
-      this->writeColumnValue("NBIN", block.Survey().getNbin());
-      this->writeColumnValue("NBIN_PRD", block.Survey().getNbin_prd());
-      this->writeColumnValue("NPOL", block.Survey().getNPol());
-      this->writeColumnValue("POL_TYPE", (char *)block.Survey().getPolType().c_str());
-      this->writeColumnValue("SCALE", (char *)block.Survey().getScale().c_str());
-      
-      
-      this->gotoPHU();
-      
-      delete [] todaysdate;
-      
-    }
-    //--------------------------------------------------------------------------
-    
-    //   void PSRFits::writeHistoryTapeFile(std::string filename)
-    void PSRFits::writeHistoryTapeFile()
-    {
-      /**
-       * Write processing history information to the HISTORY binary table 
-       * extension. This is just a row of today's date and what was entered
-       * in the command line.
-       * \deprecated
-       */
-    
-      this->gotoHistory();
-
-      char *todaysdate     = new char[25];
-      int timeref,status=0;
-      fits_get_system_time(todaysdate, &timeref, &status);
-      if(status) this->FITSError("PSRFits::writeHistoryTapeFile", status);
-
-      std::string historyMessage;
-      historyMessage = "Tape file used: " + this->oldFilename;
-
-      this->startNewRow(); 
-      this->writeColumnValue("DATE_PRO", todaysdate);
-      this->writeColumnValue("PROC_CMD", (char *)historyMessage.c_str());
-
-      this->gotoPHU();
-
-      delete [] todaysdate;
-
-    }
-    //--------------------------------------------------------------------------
-
-  }
-
-}
Index: unk/src/pvo-FITS.cc
===================================================================
--- /trunk/src/pvo-FITS.cc	(revision 486)
+++ 	(revision )
@@ -1,608 +1,0 @@
-#include <iostream>
-#include <sstream>
-#include <iomanip>
-#include <string>
-#include <time.h>
-#include <fitsio.h>
-#include "pvo.hh"
-#include "pvo-FITS.hh"
-#include "pvo-utils.hh"
-#include "pvo-block.hh"
-#include "pvo-header.hh"
-
-using namespace PVO::Block;
-using namespace PVO::Header;
-
-namespace PVO
-{
-
-  namespace FITS
-  {
-  
-    PSRFits::PSRFits()
-    {
-      this->newFile = true;
-      this->filestate = CLOSED;
-      this->UT_initial = decToDMS(0.);
-      this->verbose = true;
-      this->writingData = true;
-      this->clobber = false;
-    }
-    //-----------------------------------------------------------------------
-
-    PSRFits::PSRFits(std::string name)
-    {
-      this->filestate = CLOSED;
-      this->openFile(name);
-      this->verbose = true;
-      this->writingData = true;
-    }
-    //-----------------------------------------------------------------------
-
-    void PSRFits::FITSError(std::string function, int status){
-      /** 
-       * An error message is printed, along with the relevant CFITSIO error
-       * code and message.  
-       * \param function The function from which the error was called.  
-       * \param status The status value as returned by the CFITSIO function. 
-       *  Generally, if status != 0, an error has occurred.
-       */
-      if(this->verbose){
-	std::cerr << "\aFITSError <" << function 
-		  << "> (status="    << status   <<"): ";
-	fits_report_error(stderr, status);
-      }
-    }
-    //------------------------------------------------------------
-    template <typename T> int PSRFits::updateKeyword(std::string name, T value)
-    {
-      /**
-       *   Updates the keyword "name" in the current header unit, giving
-       *    it the value given by "value".
-       *   A templated function that should work for all cases.
-       */
-      int status=0;
-      fits_update_key(this->fptr, TINT, (char *)name.c_str(), &value, NULL, &status);
-      if(status) this->FITSError("PSRFits::updateKeyword",status);
-      return status;
-    }
-    template <> int PSRFits::updateKeyword(std::string name, int value){
-      int status=0;
-      fits_update_key(this->fptr, TINT, (char *)name.c_str(), 
-		      &value, NULL, &status);
-      if(status) this->FITSError("PSRFits::updateKeyword",status);
-      return status;
-    }
-    template <> int PSRFits::updateKeyword(std::string name, long value){
-      int status=0;
-      fits_update_key(this->fptr, TLONG, (char *)name.c_str(), 
-		      &value, NULL, &status);
-      if(status) this->FITSError("PSRFits::updateKeyword",status);
-      return status;
-    }
-    template <> int PSRFits::updateKeyword(std::string name, float value){
-      int status=0;
-      fits_update_key(this->fptr, TFLOAT, (char *)name.c_str(),
-		      &value, NULL, &status);
-      if(status) this->FITSError("PSRFits::updateKeyword",status);
-      return status;
-    }
-    template <> int PSRFits::updateKeyword(std::string name, double value){
-      int status=0;
-      fits_update_key(this->fptr, TDOUBLE, (char *)name.c_str(), 
-		      &value, NULL, &status);
-      if(status) this->FITSError("PSRFits::updateKeyword",status);
-      return status;
-    }
-    template <> int PSRFits::updateKeyword(std::string name, std::string value){
-      int status=0;
-      fits_update_key(this->fptr, TSTRING, (char *)name.c_str(), 
-		      (char *)value.c_str(), NULL, &status);
-      if(status) this->FITSError("PSRFits::updateKeyword",status);
-      return status;
-    }
-    template <> int PSRFits::updateKeyword(std::string name, char *value){
-      int status=0;
-      fits_update_key(this->fptr, TSTRING, (char *)name.c_str(), 
-		      value, NULL, &status);
-      if(status) this->FITSError("PSRFits::updateKeyword",status);
-      return status;
-    }
-    //------------------------------------------------------------------------
-  
-    template <typename T> int PSRFits::getKeyword(std::string name, T &value)
-    {
-      /**
-       *   Finds the keyword "name" in the current header unit,
-       *   returning the value in the "value" parameter.
-       *   A templated function that should work for all cases.
-       *  \param name The name of the keyword.
-       *  \param value The returned value of the keyword.
-       *  \return The status value from the fits_read_keyword function.
-       */
-      int status=0;
-      char keywordValue[80], keywordComment[80];
-      fits_read_keyword(this->fptr, (char *)name.c_str(), keywordValue, 
-			keywordComment, &status);
-      if(status) this->FITSError("PSRFits::getKeyword",status);
-      else{
-	std::stringstream ss;
-	ss.str(keywordValue);
-	ss >> value;
-      }
-      return status;
-    }
-    template int PSRFits::getKeyword<int>(std::string name, int &value);
-    template int PSRFits::getKeyword<long>(std::string name, long &value);
-    template int PSRFits::getKeyword<float>(std::string name, float &value);
-    template int PSRFits::getKeyword<double>(std::string name, double &value);
-    template <> int PSRFits::getKeyword<std::string>(std::string name, std::string &value){
-      int status=0;
-      char keywordValue[80], keywordComment[80];
-      fits_read_keyword(this->fptr, (char *)name.c_str(), keywordValue, 
-			keywordComment, &status);
-      if(status) this->FITSError("PSRFits::getKeyword",status);
-      else value = keywordValue;
-      if(value[0]=='\'') value.erase(0,1);
-      if(value[value.size()-1]=='\'') value.erase(value.size()-1,1);
-      return status;
-    }
-    
-  
-    //------------------------------------------------------------------------
-
-    void PSRFits::setCommandLine(char *executable, std::string inputFile)
-    {
-      /**
-       *  Generates a string showing what the effective shell command
-       *  was to generate the FITS file. The executable name has any
-       *  leading directories stripped off. The input name inputFile
-       *  is assigned the PSRFits::oldFilename string. No change is
-       *  made to this name (i.e. no leading directories are removed).
-       *
-       * \param executable The name of the executable from the command
-       *                    line. Can be argv[0] from 
-       *                    main(int argc, char *argv[]).
-       * \param inputFile The name of the input file.
-       */
-
-
-      //the stringstream to produce the commandLine string
-      std::stringstream ss; 
-
-      // strip off any leading directory from the executable.
-      std::string exec = executable;
-      unsigned int found = exec.rfind("/");
-      if(found != std::string::npos){
-	exec = exec.substr(found+1,exec.size()-1);
-      }
-      // write the executable to the string
-      ss << exec << " ";
-
-      // write the input filename after the executable.
-      //  This avoids problems with wildcards or the use of the -D option.
-      this->setOldFilename(inputFile);
-      ss << this->oldFilename;
-
-      // write the string to this->commandLine
-      this->commandLine = ss.str();
-
-    };
-    //----------------------------------------------------------------------
-
-    void PSRFits::setFITSname(DataBlock &block)
-    {
-      /**
-       * Generates a string containing the name of the FITS file, based on the
-       *  values of the initial date and time of the first observations in the 
-       *  file, and (if the multibeam receiver was used) the beam number. 
-       * The format is determined by the survey type. Possible formats are:
-       * <ul> <li> S70_yymmdd_hhmmss.fits
-       *      <li> PM_yymmdd_hhmmss_bb.fits </ul>
-       * \param block The block that incorporates the survey type and
-       *        allows us to work out what filename extension to use.
-       * \return String containing the FITS filename.
-       */
-      std::string date;
-      Header::SURVEY surveyType = block.getSurveyType();
-
-      for(unsigned int i=0;i<this->DATE_initial.size();i++)
-	if(DATE_initial[i]!='/') date += this->DATE_initial[i];
-
-      std::string time = removeLeadingBlanks(this->UT_initial);
-      time = decToDMS( dmsToDec(time), 0, "");
-    
-      std::stringstream output;
-      if(surveyType == S70) output << "S70_";
-      else if(surveyType == PM) output << "PM_";
-      else if(surveyType == PH) output << "PH_";
-      else PVOError("PSRFits::setFITSname","Unknown survey!\n");
-
-      output << date << "_" << time;
-
-      if((surveyType == PM)||(surveyType == PH))
-	output << "_" 
-	       << std::setw(2) << std::setfill('0') 
-	       << this->beam_number;
-
-      //      output << ".fits";
-      // Get the extension.
-      //  Base this on the MOVE parameter. 
-      PVO::FITS::EXT_TYPE ext;
-      std::string obsmode = block.getObs_mode();
-      if(obsmode=="SEARCH") ext=SEARCH;
-      else if(obsmode=="PSR") ext=TIMING;
-      else{
-	std::stringstream errmsg;
-	errmsg << "Unknown OBS_MODE (" << obsmode << ")!\n";
-	PVOError("PSRFits::setFITSname",errmsg.str());
-	ext=SEARCH;
-      }
-      output << PVO::FITS::extension[ext];
-
-      this->FITSname = output.str();
-    
-    }
-    //-----------------------------------------------------------------------
-
-    bool PSRFits::fileExists()
-    {
-      /**
-       * Checks to see whether the file is exists. Uses the CFITSIO function
-       * fits_file_exists, and the parameter PSRFits::FITSname.
-       * \return True if the file exists, false otherwise.
-       */
-      int status = 0, exists;
-      fits_file_exists(this->FITSname.c_str(), &exists, &status);
-      if(status) this->FITSError("PSRFits::fileExists",status);
-      if(exists>0) return true;
-      else return false;
-    }
-    //--------------------------------------------------------------------------
-
-    int PSRFits::openFile(std::string name, int iomode)
-    {
-      /**
-       *   If the file exists, it is opened.
-       *   If not, it is created using the correct template file.
-       *    In the latter case, the fix function is called, and the file is
-       *    flagged as "new".
-       *  \param name Filename of the fits file to be opened.
-       *  \param iomode The input/output mode for the file. Can be
-       *  either READONLY(=0) or READWRITE(=1). Default value is
-       *  READWRITE.
-       */
-      int status = 0, exists;
-      std::string fitsname = name;
-      if(this->clobber){
-	exists=0;  // pretend for the next bit that it doesn't exist.
-	fitsname = "!" + name;
-      }
-      else{
-	fits_file_exists((char *)name.c_str(),&exists,&status);
-	if(status) this->FITSError("PSRFits::openFile 1",status);
-	status=0;
-      }
-      if(exists<=0){ // File does not exist.
-	if(iomode==READWRITE){ // create it.
-	  char *template_file = (char *)getPSRFITSdefn().c_str();
-	  fits_create_template(&this->fptr, (char *)fitsname.c_str(), 
-			       template_file, &status);
-	  if(status) this->FITSError("PSRFits::openFile 2",status);
-	  else std::cout << "Creating new file " << name << "\n";
-	  this->newFile = true;
-	}
-	else if(!this->clobber){ // it *really* does not exist and we need it to
-	  std::stringstream errmsg;
-	  errmsg << name << " does not exist.\n";
-	  PVOError("PSRFits::openFile",errmsg.str());
-	  return FILE_NOT_OPENED;
-	}
-      }
-      else{ // open the file.
-	fits_open_file(&this->fptr, name.c_str(), iomode, &status);
-	if(status) this->FITSError("PSRFits::openFile 3",status);
-	this->FITSname = name;
-      }
-      if(!status) {
-	if(exists<=0) this->fixPSRFITS();
-	this->gotoPHU();
-	this->filestate = OPEN;
-      }
-      return status;
-    }
-    //--------------------------------------------------------------------------
-  
-    bool PSRFits::fitsFull(DataBlock &block)
-    {
-      /**
-       * Checks to see if the FITS file has reached the point where it
-       * needs to be closed. This should not happen until the later of:
-       * <ul><li> MOVE flag is set to moving.
-       *     <li> Number of samples is at least the minimum number
-       *     determined by the survey.
-       * </ul>
-       * \return True if we have met *both* of these conditions. False
-       * if we have not reached that point yet.
-       */
-      bool moveFlag = !block.telescopeOK();
-      bool sampleFlag = (this->numSamples >= block.Survey().getMinSamples());
-      return (moveFlag && sampleFlag);
-    }
-    //--------------------------------------------------------------------------
-  
-    int PSRFits::closeFile()
-    {
-      /**
-       *   Closes the file if it is open. 
-       *
-       *   Sets the SCANLEN header based on the offs_sub column in the
-       *   SUBINT table, so that it has the correct scanlen (not just
-       *   the value that was requested).
-       *
-       *   Writes the HISTORY table entry -- this is done now so that
-       *   we have the correct number of SUBINT rows for the NSUB
-       *   table column.
-       *
-       *   Adjusts the filestate variable as well.
-       */
-      int status = 0;
-      if(this->filestate == OPEN){
-
-	int iomode;
-	fits_file_mode(this->fptr, &iomode, &status);
-
-	if(iomode == READWRITE){
-	  float scanlen = this->calcScanLen();
-	  this->gotoPHU();
-	  this->updateKeyword("SCANLEN", scanlen );
-	  if(status) this->FITSError("PSRFits::closeFile 1",status);
-	}
-
-	this->gotoSubint();
-	int numSubintRows = this->getNumRows();
-	this->gotoHistory();
-	this->writeColumnValue("NSUB", numSubintRows);
-
-	fits_close_file(this->fptr, &status);
-	if(status) this->FITSError("PSRFits::closeFile 2",status);
-	this->filestate = CLOSED;
-      }
-      return status;
-    }
-
-    //--------------------------------------------------------------------------
-  
-    int PSRFits::gotoPHU()
-    {
-      int status = 0;
-      fits_movabs_hdu(this->fptr, 1, NULL, &status);    
-      if(status) this->FITSError("PSRFits::gotoPHU",status);
-      return status;
-    }
-    //--------------------------------------------------------------------------
-  
-    int PSRFits::gotoHistory()
-    {
-      int status = 0;
-      char name[8];
-      strcpy(name,"HISTORY");
-      fits_movnam_hdu(this->fptr, BINARY_TBL, name, 0, &status);
-      if(status) this->FITSError("PSRFits::gotoHistory",status);
-      return status;
-    }
-    //--------------------------------------------------------------------------
-  
-    int PSRFits::deleteTable(char tableName[])
-    {
-      /** 
-       * Deletes the named binary table -- first moving to the HDU then
-       * deleting it. At completion, we have returned to the PHU.
-       */ 
-      int status = 0;
-      int newHDUtype;
-      fits_movnam_hdu(this->fptr, BINARY_TBL, tableName, 0, &status);
-      if(status) this->FITSError("PSRFits::deleteTable",status);
-      fits_delete_hdu(this->fptr, &newHDUtype, &status);
-      if(status) this->FITSError("PSRFits::deleteTable",status);
-      gotoPHU();
-      return status;
-    }
-    //--------------------------------------------------------------------------
-  
-    int PSRFits::gotoSubint()
-    {
-      int status = 0;
-      char name[8];
-      strcpy(name,"SUBINT");
-      fits_movnam_hdu(this->fptr, BINARY_TBL, name, 0, &status);
-      if(status) this->FITSError("PSRFits::gotoSubint",status);
-      return status;
-    }
-    //--------------------------------------------------------------------------
-  
-    int PSRFits::getColnum(char *name)
-    {
-      int status=0,colnum=0;
-      fits_get_colnum(this->fptr, CASEINSEN, name, &colnum, &status);
-      if(status) this->FITSError("getColnum", status);
-      return colnum;
-    }
-  
-    long PSRFits::getNumRows()
-    {
-      int status=0;
-      long nrows=0;
-      fits_get_num_rows(this->fptr, &nrows, &status);
-      if(status) this->FITSError("getNumRows", status);
-      return nrows;
-    }
-    //--------------------------------------------------------------------------
-  
-    template <class T> int PSRFits::writeColumnValue(char *name, T value)
-    {
-      /**
-       *   Writes a new value in the column "name" in the current binary table.
-       *   It adds a single value at the bottom of the table (ie. in the largest
-       *    numbered row).
-       *   A templated function that should work for all cases.
-       */
-      int status=0;
-      int colnum = this->getColnum(name);
-      long nrows = this->getNumRows();
-      fits_write_col(this->fptr, TINT, colnum, nrows, 1, 1, &value, &status);
-      if(status) this->FITSError("PSRFits::writeColumnValue", status);
-      return status;
-    }
-    template int PSRFits::writeColumnValue<int>(char *name, int value);
-    template <> int PSRFits::writeColumnValue(char *name, long value)
-    {
-      int status=0;
-      int colnum = this->getColnum(name);
-      long nrows = this->getNumRows();
-      fits_write_col(this->fptr, TLONG, colnum, nrows, 1, 1, &value, &status);
-      if(status) this->FITSError("PSRFits::writeColumnValue", status);
-      return status;
-    }
-    template <> int PSRFits::writeColumnValue(char *name, float value)
-    {
-      int status=0;
-      int colnum = this->getColnum(name);
-      long nrows = this->getNumRows();
-      fits_write_col(this->fptr, TFLOAT, colnum, nrows, 1, 1, &value, &status);
-      if(status) this->FITSError("PSRFits::writeColumnValue", status);
-      return status;
-    }
-    template <> int PSRFits::writeColumnValue(char *name, double value)
-    {
-      int status=0;
-      int colnum = this->getColnum(name);
-      long nrows = this->getNumRows();
-      fits_write_col(this->fptr, TDOUBLE, colnum, nrows, 1, 1, &value, &status);
-      if(status) this->FITSError("PSRFits::writeColumnValue", status);
-      return status;
-    }
-    template <> int PSRFits::writeColumnValue(char *name, char *value)
-    {
-      int status=0;
-      int colnum = this->getColnum(name);
-      long nrows = this->getNumRows();
-      fits_write_col(this->fptr, TSTRING, colnum, nrows, 1, 1, &value, &status);
-      if(status) this->FITSError("PSRFits::writeColumnValue", status);
-      return status;
-    }
-     //--------------------------------------------------------------------------
-  
-    template <class T> int PSRFits::readColumnValue(char *name, int row, T *value)
-    {
-      /**
-       *   Read the value in the column "name" in the current binary table.
-       *   If the column is not present, the corresponding null value is returned. 
-       *   A templated function that should work for all cases.
-       */
-      int status=0, anynul=0;
-      int colnum = this->getColnum(name);
-      T null=nullInt;
-      fits_read_col(this->fptr, TINT, colnum, row, 1, 1, &null, value, &anynul, &status);
-      if(status) this->FITSError("PSRFits::readColumnValue", status);
-      return status;
-    }
-    template int PSRFits::readColumnValue<int>(char *name, int row, int *value);
-    template <> int PSRFits::readColumnValue(char *name, int row, long *value)
-    {
-      int status=0, anynul=0;
-      int colnum = this->getColnum(name);
-      long null=nullInt;
-      fits_read_col(this->fptr, TLONG, colnum, row, 1, 1, &null, value, &anynul, &status);
-      if(status) this->FITSError("PSRFits::readColumnValue", status);
-      return status;
-    }
-    template <> int PSRFits::readColumnValue(char *name, int row, float *value)
-    {
-      int status=0, anynul=0;
-      int colnum = this->getColnum(name);
-      float null=nullFloat;
-      fits_read_col(this->fptr, TFLOAT, colnum, row, 1, 1, &null, value, &anynul, &status);
-      if(status) this->FITSError("PSRFits::readColumnValue", status);
-      return status;
-    }
-    template <> int PSRFits::readColumnValue(char *name, int row, double *value)
-    {
-      int status=0, anynul=0;
-      int colnum = this->getColnum(name);
-      double null=nullFloat;
-      fits_read_col(this->fptr, TDOUBLE, colnum, row, 1, 1, &null, value, &anynul, &status);
-      if(status) this->FITSError("PSRFits::readColumnValue", status);
-      return status;
-    }
-    template <> int PSRFits::readColumnValue(char *name, int row, char *value)
-    {
-      int status=0, anynul=0;
-      int colnum = this->getColnum(name);
-      char *null = new char[nullString.size()+1];
-      strcpy(null,nullString.c_str());
-      fits_read_col(this->fptr, TSTRING, colnum, row, 1, 1, null, value, &anynul, &status);
-      if(status) this->FITSError("PSRFits::readColumnValue", status);
-      return status;
-    }
-    //--------------------------------------------------------------------------
-
-    int PSRFits::startNewRow()
-    {
-      /**
-       *    Adds a new row to the bottom of the current binary table.
-       *    Also adds the row number as the ISUBINT column value.
-       */
-      int nrows = this->getNumRows();
-      int status = 0;
-      fits_insert_rows(this->fptr, nrows, 1, &status);
-      if(status) this->FITSError("PSRFits::startNewRow", status);
-      return status;
-    }
-    //--------------------------------------------------------------------------
-
-    void PSRFits::startNewSubintRow()
-    {
-      /**
-       *    Adds a new row to the bottom of the current binary table.
-       *    Also adds the row number as the ISUBINT column value.
-       */
-      this->startNewRow();
-      this->writeColumnValue("ISUBINT", this->getNumRows());
-    }
-    //--------------------------------------------------------------------------
-
-    float PSRFits::calcScanLen()
-    {
-      /**
-       *  Calculate the actual scan length of the FITS file by looking
-       *  at the offs_sub column in the SUBINT table. We look at the
-       *  last value, and add half the BLK_SEC value to it to get the
-       *  total elapsed time.
-       *
-       * \return The total scan length of the FITS file.
-       */
-
-      this->gotoSubint();
-      int numrows = this->getNumRows();
-      float scanlen,oldscanlen,blksec;
-      int status = this->readColumnValue<float>("OFFS_SUB",numrows,&scanlen);
-      if(status) this->FITSError("PSRFits::calcScanLen 1", status);
-      if(numrows==1){
-	scanlen *= 2.;
-      }
-      else{
-	status = this->readColumnValue<float>("OFFS_SUB",numrows-1,&oldscanlen);
-	if(status) this->FITSError("PSRFits::calcScanLen 2", status);
-	blksec = scanlen - oldscanlen;
-	scanlen += 0.5 * blksec;
-      }
-      this->gotoPHU();
-      return scanlen;
-
-    }
-
-
-  }
-
-}
Index: unk/src/pvo-FITS.hh
===================================================================
--- /trunk/src/pvo-FITS.hh	(revision 486)
+++ 	(revision )
@@ -1,350 +1,0 @@
-#ifndef PSRFITS_HH_
-#define PSRFITS_HH_
-#include <fitsio.h>
-#include <string>
-#include "pvo-block.hh"
-#include "pvo-header.hh"
-
-using namespace PVO::Block;
-using namespace PVO::Header;
-
-namespace PVO
-{
-
-
-  /**
-   * The namespace to control all things related to reading and writing
-   * fits files in the PSRFITS format.
-   */ 
-
-  namespace FITS
-  {
-
-    /** Has a function worked or not? */
-    enum RESULT { SUCCESS, FAILURE };
-	
-    /** The state of the file */
-    enum STATE { OPEN,  ///< file is open
-		 CLOSED ///< file is closed
-    };
-
-    const int numExtension = 2;
-    enum EXT_TYPE { SEARCH, TIMING };
-    const std::string extension[numExtension] = {".sf", ".rf"};
-
-
-    //===========================================================
-
-    /**
-     *  A class to keep track of the header keywords for the SUBINT
-     *  binary table extension.
-     */
-    class Subint
-    {
-    public:
-
-
-      Subint(){
-	allocated = false;
-	nchoffs = 0;
-	int_type = "TIME";
-	int_unit = "SEC";
-      };
-      virtual ~Subint(){
-	if(allocated){
-	  delete [] dat_freq;
-	  delete [] dat_wts;
-	  delete [] dat_offs;
-	  delete [] dat_scl;
-	}
-      };
-
-      friend class PSRFits;
-
-      long   getNchan(){return nchan;};
-      void   setNchan(long l){nchan=l;};
-      float  getChanBW(){return chan_bw;};
-      void   setChanBW(float f){chan_bw=f;};
-      long   getNchoffs(){return nchoffs;};
-      void   setNchoffs(long l){ nchoffs=l;};
-      long   getNbits(){return nbits;};
-      void   setNbits(long l){nbits=l;};
-      long   getNbin(){return nbin;};
-      void   setNbin(long l){nbin=l;};
-      long   getNbin_prd(){return nbin_prd;};
-      void   setNbin_prd(long l){nbin_prd=l;};
-      float  getPhs_offs(){return phs_offs;};
-      void   setPhs_offs(float f){phs_offs=f;};
-      long   getNsuboffs(){return nsuboffs;};
-      void   setNsuboffs(long l){nsuboffs=l;};
-      long   getNpol(){return npol;};
-      void   setNpol(long l){npol=l;};
-      std::string getPol_type(){return pol_type;};
-      void   setPol_type(std::string s){pol_type=s;};
-      std::string getScale(){return scale;};
-      void   setScale(std::string s){scale=s;};
-      long   getNsblk(){return nsblk;};
-      void   setNsblk(long l){nsblk=l;};
-      float  getTsamp(){return tsamp;};
-      void   setTsamp(float f){tsamp=f;};
-      std::string getInt_type(){return int_type;};
-      void   setInt_type(std::string s){int_type=s;};
-      std::string getInt_unit(){return int_unit;};
-      void   setInt_unit(std::string s){int_unit=s;};
-      bool   getAllocatedFlag(){return allocated;};
-      void   setAllocatedFlag(bool b){allocated=b;};
-
-      float *getDAT_freq(){return dat_freq;};
-      void   setDAT_freq(float *f){dat_freq=f;};
-      float *getDAT_wts(){return dat_wts;};
-      void   setDAT_wts(float *f){dat_wts=f;};
-      float *getDAT_offs(){return dat_offs;};
-      void   setDAT_offs(float *f){dat_offs=f;};
-      float *getDAT_scl(){return dat_scl;};
-      void   setDAT_scl(float *f){dat_scl=f;};
-
-      /** Return the size of the data array */
-      long   getDataSize(){return nbits*nchan*npol*nsblk;};
-
-      /** Return the size of the data array in bytes */
-      long   getDataSizeBytes(){return nbits*nchan*npol*nsblk / 8;};
-
-      /** A function that will write to a file the full set of keywords. */
-      int    writeKeywords(fitsfile *fptr);
- 
-    private:
-      long        nbin;       ///< The SUBINT table keyword NBIN
-      long        nbits;      ///< The SUBINT table keyword NBITS
-      long        nchoffs;    ///< The SUBINT table keyword NCHOFFS
-      long        nchan;      ///< The SUBINT table keyword NCHAN
-      float       chan_bw;    ///< The SUBINT table keyword CHAN_BW
-      long        nbin_prd;   ///< The SUBINT table keyword NBIN_PRD
-      float       phs_offs;   ///< The SUBINT table keyword PHS_OFFS
-      long        nsuboffs;   ///< The SUBINT table keyword NSUBOFFS
-      long        npol;	      ///< The SUBINT table keyword NPOL
-      std::string pol_type;   ///< The SUBINT table keyword POL_TYPE
-      std::string scale;      ///< The SUBINT table keyword SCALE
-      long        nsblk;      ///< The SUBINT table keyword NSBLK
-      std::string int_type;   ///< The SUBINT table keyword INT_TYPE
-      std::string int_unit;   ///< The SUBINT table keyword INT_UNIT
-      float       tsamp;	    ///< The SUBINT table keyword TSAMP
-
-      bool        allocated;  ///< Have the arrays been allocated yet?
-      float      *dat_freq;   ///< The SUBINT table array DAT_FREQ
-      float      *dat_wts;    ///< The SUBINT table array DAT_WTS
-      float      *dat_offs;   ///< The SUBINT table array DAT_OFFS
-      float      *dat_scl;    ///< The SUBINT table array DAT_SCL
-
-
-    };
-
-  
-    const int SUBINT_kw_nch_strt = 0; 
-    ///< The nch_strt keyword for the SUBINT table.
-
-    const std::string SUBINT_kw_int_type = "TIME";
-    ///< The int_type keyword for the SUBINT table.
-
-    const std::string SUBINT_kw_int_unit = "SEC"; 
-    ///< The int_unit keyword for the SUBINT table.
-  
-    const std::string PHU_kw_coord_md = "J2000.0"; 
-    ///< The coord_md keyword for the Primary header.
-
-    const double PHU_stt_offs_default = 0.;
-    ///< The default value for the STT_OFFS PHU keyword. */
-  
-    /**
-     * A class to deal with individual fits files.
-     * This keeps track of all information relevant for a particular PSRFITS file.
-     * All the functions that write to particular extensions are in here, as 
-     *  well as general I/O routines.
-     */ 
-
-    class PSRFits
-    {
-    public:
-      PSRFits(); ///<
-      PSRFits(std::string name);
-      virtual ~PSRFits(){};
-
-      // Inline functions
-      /** Is the file newly created? */
-      bool        isNewFile(){return newFile;};
-      void        setNewFile(){newFile = true;};
-      void        setNewFile(bool f){newFile = f;};
-
-      /** Is the file open or closed? */
-      STATE       getFilestate(){return filestate;};
-
-      /** Set the file state. */
-      void        setFilestate(STATE S){filestate=S;};
-
-      bool        clobberFile(){return clobber;};
-      void        setClobber(bool b){clobber = b;};
-
-      /** Are we writing data to the FITS file? */
-      bool       areWritingData(){return writingData;};
-
-      /** Define whether we are writing data to the FITS file. */
-      void       setWritingData(bool b){writingData=b;};
-
-      /** Get the UT of the first observations in the input file. */
-      std::string getUTinput(){return UT_input;};
-
-      /** Save the UT of the first observations. */
-      void        setUTinput(std::string s){UT_input=s;};
-
-      /** Get the UT of the first observations in the FITS file. */
-      std::string getUT(){return UT_initial;};
-
-      /** Save the UT of the first observations. */
-      void        setUT(std::string s){UT_initial=s;};
-
-      /** Get the date of the first observations in the file. */
-      std::string getDate(){return DATE_initial;};
-
-      /** Save the date of the first observations. */
-      void        setDate(std::string s){DATE_initial=s;};
-
-      /** Get the beam number used for the observations. */
-      int         getBeam(){return beam_number;};
-
-      /** Save the beam number used for the observations. */
-      void        setBeam(int i){beam_number=i;};
-
-      /** Get the filename of the fits file. */
-      std::string getFITSname(){return FITSname;};
-
-      /** Manually set the filename of the fits file. */
-      void        setFITSname(std::string name){FITSname = name;};
-
-      /** Get the number of the first block stored in the file. */
-      int         getInitialBlock(){return blk_initial;};
-
-      /** Save the number of the first block stored in the file. */
-      void        setInitialBlock(int block){blk_initial = block;};
-
-      /** Opens file -- uses openFile(std::string) */
-      int         openFile(){ return this->openFile(this->FITSname); };
-
-
-      // Functions found in pvo-FITS.cc (in the same order...)
-      /** Generate the name of the fits file. */
-      void        setFITSname(DataBlock &block); 
-
-      /** Does the file exist on disk already? */
-      bool        fileExists();                           
-       
-      /** Opens the file named by the argument. */
-      int         openFile(std::string name, int iomode=READWRITE);
-       
-      /** Makes corrections to PSRFITS definition. */
-      void        fixPSRFITS();  
-       
-      /** Writes new keywords to the primary fits header. */
-      void        addNewKeywords(DataBlock &block); 
-    
-      /** Check whether the FITS file should be closed. */
-      bool        fitsFull(DataBlock &block);
-      long        getNumSamples(){return numSamples;};
-
-      int         closeFile();   ///< Closes the file.
-      int         gotoPHU();     ///< Moves to the primary header unit
-      int         gotoHistory(); ///< Moves to the HISTORY binary table
-      ///   extension.
-      int         gotoSubint();  ///< Moves to the SUBINT binary table
-      ///   extension.
-
-      /** Delete a named binary table. */
-      int         deleteTable(char tableName[]);
-
-      /** Update the value of a keyword. */
-      template <class T> int updateKeyword(std::string name, T value); 
-
-      /** Return the value of a keyword. */
-      template <class T> int getKeyword(std::string name, T &value); 
-
-      /** Calculate the scan length from the offs_sub column in the SUBINT table */
-      float       calcScanLen();
-
-      /** Returns the number of the named column. */
-      int         getColnum(char *name);
-       
-      /** Returns the number of rows in the current binary table. */
-      long        getNumRows();          
-
-      /** Write a value to a named column. */
-      template <class T> int writeColumnValue(char *name, T value);
-
-      /** Write a named column value. */
-      template <class T> int readColumnValue(char *name, int row, T *value);
-
-      /** Add new row to current table. */
-      int         startNewRow();         
-
-      /** Add new row to SUBINT table. */
-      void        startNewSubintRow();   
-
-      /** Write Primary Header Unit data. */
-      void        writePHU(DataBlock &block);      
-
-      /** Set up a FITS file */       
-      int         initialise(DataBlock &block);
-
-      /** Define and write the header keywords for the SUBINT table. */
-      void        setupSubint(DataBlock &block);
-
-      /** Write a row of SUBINT table data. */
-      void        writeSubintRow(DataBlock &block);          
-
-      /** Write information to HISTORY table. */
-      //     void        writeHistoryCommand(int argc, char * argv[]);
-      void        writeHistoryCommand(DataBlock &block);
-      void        writeHistoryTapeFile();
-
-      /** Dealing with the command line arguments */
-      void        setCommandLine(char *executable, std::string inputFile);
-
-      /** Storing the name of the old-format (input) data file */
-      void        setOldFilename(std::string filename){oldFilename = filename;};
-      /** Report a CFITSIO error, along with the offending function. */
-      void FITSError(std::string function, int status);
-
-      /** Set the verbose flag */
-      void setVerbosity(bool b){verbose=b;};
-
-    private:
-      fitsfile *fptr;           ///< The CFITSIO file variable
-      std::string FITSname;     ///< The output FITS filename
-      bool clobber;             ///< Shall we overwrite an existing file?
-      bool newFile;             ///< Is the file a new one?
-      STATE filestate;          ///< OPEN or CLOSED?
-      bool writingData;         ///< Are we writing data to the FITS file?
-      std::string UT_input;     ///< The UT time at the start of the
-				///   input data.
-      std::string UT_initial;   ///< The UT time at the start of the
-				///   FITS file's data
-      std::string DATE_initial; ///< The UT date at the start of the
-				///   FITS file's data.
-      int beam_number;          ///< What beam are we using? Necessary
-				///   for FITS file name
-      int blk_initial;          ///< The block number of the first
-				///   block in the file.
-      long numSamples;          ///< The number of samples stored in
-				///   the FITS file.
-      Subint subintTable;       ///< Subint class containing table
-				///   header keywords.
-
-      std::string oldFilename;  ///< The filename of the old-format data.
-      std::string commandLine;  ///< The full command-line statement.
-
-      bool verbose;             ///< Whether to print all error messages.
-
-    };
-
-  }
-
-}
-
-#endif /*PSRFITS_HH_*/
Index: unk/src/pvo-block.cc
===================================================================
--- /trunk/src/pvo-block.cc	(revision 486)
+++ 	(revision )
@@ -1,431 +1,0 @@
-#include "pvo-header.hh"
-#include "pvo-block.hh"
-#include "pvo-utils.hh"
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <iomanip>
-#include <string>
-#include <vector>
-
-using std::string;
-using namespace PVO::Header;
- 
-namespace PVO
-{
-
-  namespace Block
-  {
-
-    DataBlock::DataBlock(Header::SURVEY inputSurveyType)
-    {
-      /**
-       * Initialise a block, by allocating the various arrays 
-       *
-       */
-      this->headerString = string(" ",headerLength);
-      Header::SurveySchema *temp = new Header::SurveySchema(inputSurveyType);
-      this->survey = *temp;
-      this->surveyType = inputSurveyType;
-      this->data = new unsigned char[dataLength];
-      //     this->surveyName = survey;
-      delete temp;
-    }
-    //-----------------------------------------------------------------------
-
-    DataBlock::DataBlock(const DataBlock& b)
-    {
-      headerString = b.headerString;
-      survey       = b.survey;
-      surveyType   = b.surveyType;
-      surveyName   = b.surveyName;
-      data = new unsigned char[dataLength];
-      for(int i=0;i<dataLength;i++) data[i] = b.data[i];
-    }
-    //-----------------------------------------------------------------------
-    DataBlock &DataBlock::operator= (const DataBlock& b)
-    {
-      if(this == &b) return *this;
-      this->headerString = b.headerString;
-      this->survey       = b.survey;
-      this->surveyType   = b.surveyType;
-      this->surveyName   = b.surveyName;
-      this->data = new unsigned char[dataLength];
-      for(int i=0;i<dataLength;i++) this->data[i] = b.data[i];
-      return *this;
-    }
-    //-----------------------------------------------------------------------
-
-    DataBlock::~DataBlock()
-    {
-      /** Deallocate survey and data first. */
-      delete [] this->data;
-    }
-    //-----------------------------------------------------------------------
-
-    bool DataBlock::readBlock(std::ifstream &file)
-    {
-      /**
-       * Front end to the other two read functions.
-       * \param file The file stream to read the block from.
-       * \return False if readHeader() does not work. Otherwise true.
-       */
-      if(!this->readHeader(file)) return false;
-      this->readData(file);
-      return true;
-    }
-    //--------------------------------------------------------------------------
-
-    bool DataBlock::readHeader(std::ifstream &file)
-    {
-      /**
-       * Read in the full set of header information into the
-       * headerString string.
-       * \param file The file stream to read the block from.
-       * \return False if the file is at eof, else read header and return true.
-       */
-      char *hdr = new char[Block::headerLength];
-      file.read( hdr, headerLength*sizeof(char) );
-      bool returnval = true;;
-      if(file.eof()) returnval = false;
-      for(int c=0;c<headerLength;c++) this->headerString[c] = hdr[c];
-      delete [] hdr;
-      return returnval;
-    }
-    //--------------------------------------------------------------------------
-
-    void DataBlock::readData(std::ifstream &file)
-    {
-      /**
-       * Read in the full set of data into the data array (as type
-       * char). The order of the bits in each byte are reversed, so
-       * that the frequency increases monotonically across the array
-       * of chars.
-       * \param file The file stream to read the block from.
-       * \return No return value, as the file is assumed to be open.
-       */
-      char *tempdata = new char[dataLength];
-      file.read( tempdata, dataLength*sizeof(char) );
-
-      double chanbw = this->getKeyword<double>(CHANBW);
-
-      for(int i=0;i<dataLength;i++){
-	unsigned char temp = tempdata[i];
-
-	// Reverse the order of the bits in the byte
-	this->data[i] = reverseByte(temp);
-
-	// // This bit was from when we thought the byte-reversal need
-	// only be done for the negative-bandwidth case. Have since
-	// decided all cases need it.
-// 	if(chanbw < 0.)  this->data[i] = reverseByte(temp);
-// 	else this->data[i] = temp;
-
-	// // This bit was for inverting each of the bits within
-	// //	the byte. Has been decided this is not needed.
-	//	unsigned char temp2= reverseByte(temp); 
-	//      this->data[i] = bitToggle(temp2);
-      }
-
-      delete [] tempdata;
-
-    }
-    //--------------------------------------------------------------------------
-
-    void DataBlock::saveData(unsigned char *dataArray, int size)
-    {
-      /**
-       * Saves an array of char values to the data array
-       * \param dataArray The array of bytes to be saved.
-       * \param size The size of dataArray. If less than
-       * Block::dataLength, all elements will be written, but if more,
-       * only Block::dataLength elements will be written
-       * \return No return value.
-       */
-
-      int max = size;
-      if(size>Block::dataLength) max = Block::dataLength;
-      for(int i=0;i<max;i++) this->data[i] = dataArray[i];
-    
-    }
-    //--------------------------------------------------------------------------
-
-    std::string DataBlock::getEquinox()
-    {
-      /**
-       * Returns the value of the equinox, assuming the coordinate type
-       * is equatorial. If we are using Galactic or Ecliptic, a blank
-       * string is returned.
-       *\return A std::string containing the equinox value.
-       */
-      int type = this->getKeyword<int>(COORD_TYPE);
-      std::string output;
-      switch(type){
-      case 2: output = "";               break;
-      case 3: output = Block::eq_b1950;  break;
-      case 4: output = "";               break;
-      case 5:
-      default: output = Block::eq_j2000; break;
-      }
-      return output;
-    }
-    //--------------------------------------------------------------------------
-
-    std::string DataBlock::getCoordMode()
-    {
-      /**
-       * Returns the value of the coord_md keyword as one of a number of
-       * alternative strings. This keyword should be one of EQUAT, GAL,
-       * ECLIP, etc. If the equinox is B1950 or J2000, return EQUAT.
-       * \return A coord type: one of EQUAT, GAL, ECLIP...
-       */
-      int type = this->getKeyword<int>(COORD_TYPE);
-      std::string output;
-      switch(type){
-      case 2: output = Block::eq_date;   break;
-      case 3: output = Block::eq_equat;  break;
-      case 4: output = Block::eq_gal;    break;
-      case 5:
-      default: output = Block::eq_equat; break;
-      }
-      return output;
-    }
-    //--------------------------------------------------------------------------
-
-    std::string DataBlock::getObs_mode()
-    {
-      /**
-       * Returns the value of the OBS_MODE keyword as one of a number of
-       * alternative strings. This keyword should be one of PSR, CAL,
-       * or SEARCH. 
-       *
-       * The differentiation between them is done on the basis of the
-       * MOVE parameter: 0 means we are sitting on a pulsar, so it is
-       * PSR; 1 means we are doing a survey scan, so it is SEARCH.
-       *
-       * \return The OBS_MODE header keyword.
-       */
-      int move = this->getKeyword<int>(MOVE);
-      std::string output;
-      if(this->surveyType==S70){
-	switch(move){
-	case 0: output = "PSR";   break;
-	case 1:
-	default: output = "SEARCH"; break;
-	}
-      }
-      else if((this->surveyType==PM)||(this->surveyType==PH)){
-	output = "SEARCH";
-// 	switch(move){
-// 	case 90: 
-// 	case 80: 
-// 	case 70: 
-// 	case 60: 
-// 	case 50: 
-// 	case 40: 
-// 	case 30: 
-// 	case 20: 
-// 	case 10: 
-// 	case 0: output = "PSR";   break;
-// 	case 1:
-// 	case 2:
-// 	case 3:
-// 	default: output = "SEARCH"; break;
-// 	}
-      }
-      return output;
-    }
-    //--------------------------------------------------------------------------
-
-    bool DataBlock::telescopeOK()
-    {
-      /**
-       * A way of determining whether the current block was taken at a time
-       *  when the telescope was suitably positioned.
-       *
-       * The function tests the MOVE keyword (which is a coded integer),
-       * and translates it according to the survey being conducted. There are
-       * particular values of the keyword that are acceptable for each survey,
-       * and if the keyword takes this value, everything is OK. Otherwise, the
-       * telescope may have been moving, or not in survey mode.
-       * \return True if everything is OK, false otherwise.
-       */
-      std::string move=this->getKeyword<std::string>(MOVE);
-
-      if(this->surveyType == S70){
-	if(move == "00") return true;
-	else if(move == "01") return true;
-	else if(move == "02") return false;
-	else return false;
-      }
-      else if((this->surveyType == PM)||(this->surveyType == PH)){
-	if(move[1]=='0') return true;
-	else return false;
-      }
-      return false;
-    }
-    //--------------------------------------------------------------------------
-
-    std::string DataBlock::getFieldID()
-    {
-      std::string temp,field="";
-      if(this->surveyType==S70){
-	std::stringstream ss;
-	ss.str(this->headerString.substr(this->survey.getStartPosition(COMMENT),
-					 this->survey.getFieldLength(COMMENT)));
-	do{ ss >> temp; } while( temp[0]!='G' && !ss.eof());
-	if(temp[0]=='G') field=temp;
-	field = deblank(field);
-      }
-      return field;
-    }
-    //--------------------------------------------------------------------------
-
-    std::string DataBlock::getFITSname()
-    {
-      /**
-       * Generates a string containing the name of the FITS file that the block
-       * data should be written to. This depends on the survey, the date & time,
-       * and (if the multibeam receiver was used) the beam number:
-       * <ul> <li> S70_yymmdd_hhmmss.fits
-       *      <li> PM_yymmdd_hhmmss_bb.fits </ul>
-       * \return String containing the FITS filename.
-       */
-      std::string date = this->getKeyword<std::string>(DATE);
-      std::string newdate;
-
-      for(unsigned int i=0;i<date.size();i++)
-	if(date[i]!='/') newdate += date[i];
-
-      std::string time = this->getKeyword<std::string>(UT_STRT);
-      time = removeLeadingBlanks(time);
-      time = decToDMS( dmsToDec(time), 0, "");
-    
-      std::stringstream output;
-      if(this->surveyType == S70) output << "S70_";
-      else if(this->surveyType == PM) output << "PM_";
-      else if(this->surveyType == PH) output << "PH_";
-      else PVOError("DataBlock::getFITSname","Unknown survey!\n");
-
-      output << newdate << "_" << time;
-
-      if((this->surveyType == PM)||(this->surveyType == PH))
-	output << "_" 
-	       << std::setw(2) << std::setfill('0') 
-	       << this->getKeyword<int>(IBEAM);
-
-      output << ".fits";
-
-      return output.str();
-
-    }
-    //--------------------------------------------------------------------------
-    //   template <typename Type> 
-    //   Type DataBlock::getKeyword(int field, int element)
-    //   {
-    //     Type output = 
-    //       this->survey.readParameter<Type>(this->headerString,field,element);
-    //     return output;
-    //   }
-    //   template int DataBlock::getKeyword<int>(int field, int element);
-    //   template float DataBlock::getKeyword<float>(int field, int element);
-    //   template string DataBlock::getKeyword<string>(int field, int element);
-    //--------------------------------------------------------------------------
-
-    template <class T> 
-    T DataBlock::getKeyword(int field, int elementNumber)
-    {
-      /**
-       * Returns the value of the keyword. In the case of keywords that have more
-       * than one value (some have 2 values, one for each band, and some have up 
-       * to 8, describing individual comments etc), one can select which element
-       * to return. This choice defaults to the first one if not given.
-       *
-       * The function is templated, so that you can elect to get the
-       * numerical value or the string representation of the keyword.
-       *
-       * \param field The number representing the keyword field. This can be
-       * represented by the enumerated list of values given by Header::FIELDS.
-       * \param elementNumber Optional parameter indicating which element of a
-       * multi-dimensional keyword to return. Defaults to 0, which is the first
-       * element.
-       */
-      int dim = this->survey.getFieldDimension(field);
-      std::stringstream ss;
-      std::vector<T> output(dim);
-      for(int i=0;i<dim;i++){
-	int start = this->survey.getStartPosition(field)+i*dim;
-	int length = this->survey.getFieldLength(field);
-	ss.str(this->headerString.substr(start,length));
-	ss >> output[i];      
-      }
-      return output[elementNumber];
-    }
-    template int DataBlock::getKeyword<int>(int field, int elementNumber);
-    template float DataBlock::getKeyword<float>(int field, int elementNumber);
-    template double DataBlock::getKeyword<double>(int field, int elementNumber);
-    template std::string DataBlock::getKeyword<std::string>(int field, int elementNumber);
-  
-    //   template<> int DataBlock::getKeyword<int>(int field, int element){
-    //     return this->survey.readParameter<int>(this->headerString,field,element);
-    //   }
-    //   template<> float DataBlock::getKeyword<float>(int field, int element){
-    //     return this->survey.readParameter<float>(this->headerString,field,element);
-    //   }
-    //   template<> double DataBlock::getKeyword<double>(int field, int element){
-    //     return this->survey.readParameter<double>(this->headerString,field,element);
-    //   }
-    //   template<> string DataBlock::getKeyword<string>(int field, int element){
-    //    return this->survey.readParameter<string>(this->headerString,field,element);
-    //   }
-    //--------------------------------------------------------------------------
-    template <class T> 
-    std::vector<T> DataBlock::getFullKeyword(int field)
-    {
-      /**
-       * Returns the full list of values of the keyword, in a vector of
-       * the relevant (or requested) type. This function is useful to
-       * obtain all values for the case of keywords that have more than
-       * one value (some have 2 values, one for each band, and some have
-       * up to 8, describing individual comments etc).
-       *
-       * The function is templated, so that you can elect to get the
-       * numerical values or the string representations of individual
-       * values of the keyword.
-       *
-       * \param field The number representing the keyword field. This can be
-       * represented by the enumerated list of values given by Header::FIELDS.
-       */
-      int dim = this->survey.getFieldDimension(field);
-      std::stringstream ss;
-      std::vector<T> output(dim);
-      for(int i=0;i<dim;i++){
-	int start = this->survey.getStartPosition(field)+i*dim;
-	int length = this->survey.getFieldLength(field);
-	ss.str(this->headerString.substr(start,length));
-	ss >> output[i];      
-      }
-      return output;
-    }
-    template<> std::vector<int> DataBlock::getFullKeyword<int>(int field){
-      std::vector<int> output(this->survey.getFieldDimension(field));
-      for(int i=0;i<this->survey.getFieldDimension(field);i++)
-	output[i]=this->survey.readParameter<int>(this->headerString,field,i);
-      return output;
-    }
-    template<> std::vector<float> DataBlock::getFullKeyword<float>(int field){
-      std::vector<float> output(this->survey.getFieldDimension(field));
-      for(int i=0;i<this->survey.getFieldDimension(field);i++)
-	output[i]= this->survey.readParameter<float>(this->headerString,field,i);
-      return output;
-    }
-    template<> std::vector<string> DataBlock::getFullKeyword<string>(int field){
-      std::vector<string> output(this->survey.getFieldDimension(field));
-      for(int i=0;i<this->survey.getFieldDimension(field);i++)
-	output[i]=this->survey.readParameter<string>(this->headerString,field,i);
-      return output;
-    }
-
-  }
-
-}
Index: unk/src/pvo-block.hh
===================================================================
--- /trunk/src/pvo-block.hh	(revision 486)
+++ 	(revision )
@@ -1,120 +1,0 @@
-#ifndef BLOCK_HH_
-#define BLOCK_HH_
-#include <iostream>
-#include <fstream>
-#include <string>
-#include <vector>
-#include "pvo-header.hh"
-
-namespace PVO
-{
-
-  /** This controls the way blocks from existing survey files are
-      dealt with. */
-  namespace Block
-  {
-    const int headerLength = 640; ///< The length of the header string [bytes]
-    /** The length of the data part of the block [bytes] */
-    const int dataLength = 49152; // = 48*1024
-    /** Four possible ways to express the equinox. These are return
-	values for DataBlock::getEquinox().  */
-    const std::string eq_date  = "Equat. of date"; 
-    const std::string eq_b1950 = "B1950";
-    const std::string eq_gal   = "GAL";
-    const std::string eq_j2000 = "J2000";
-    const std::string eq_equat = "J2000";
-    //const std::string eq_equat = "EQUAT";
-    const float eq_1950 = 1950.;
-    const float eq_2000 = 2000.;
-
-    /**
-     *  A single block of data.
-     *
-     *  This class holds one block of data: 48k long, plus 640 bytes
-     *  of header information. It also records information about the 
-     *  type of survey that the data is from, as well as the schema 
-     *  defining how the headers are defined (which depends on the survey).
-     */
-
-    class DataBlock
-    {
-    public:
-      /** Constructor for particular survey. */
-      DataBlock(Header::SURVEY surveyType);
-      DataBlock(const DataBlock& b);
-      DataBlock& operator= (const DataBlock& b);
-      virtual ~DataBlock(); ///< Destructor
-
-      /** Read in a full block (headers+data) from a file stream. */
-      bool readBlock(std::ifstream &file);
-
-      /** Read in the headers from a file stream. */
-      bool readHeader(std::ifstream &file);
-
-      /** Read in the data from a file stream. */
-      void readData(std::ifstream &file);
-
-      /** Save an array of data to the Block. */
-      void saveData(unsigned char *dataArray, int size);
-
-      /** Get an individual data point. */
-      unsigned char getDatum(int i){return data[i];};
-
-      /** Get the entire string of data */
-      unsigned char *getData(){return data;};
-
-      /** Get the name of the survey */
-      std::string getSurveyName(){return surveyName;};
-
-      /** Get the type of survey */
-      Header::SURVEY getSurveyType(){return surveyType;};
-
-      /** Get the equinox in a string format. */
-      std::string getEquinox();
-
-      /** Get the coordinate type. */
-      std::string getCoordMode();
-
-      /** Get the OBS_MODE header */
-      std::string getObs_mode();
-
-      /** Was the telescope not moving, and tracking fine for this block? */
-      bool telescopeOK();
-
-      /** Get the S70 survey field ID. */
-      std::string getFieldID();
-
-      /** Generate the name of the fits file this block should be written to. */
-      std::string getFITSname();
-
-      /** Return a particular element of a keyword set */
-      template <typename T> T getKeyword(int field, int elementNumber=0);
-
-      /** Return the full set of values for a particular keyword */
-      template <typename T> std::vector<T> getFullKeyword(int field);
-
-      /** Provide a reference to the survey schema. */
-      Header::SurveySchema& Survey(){
-	Header::SurveySchema& rsurv=survey;
-	return rsurv;
-      };
-
-      /** Provide a reference to the header string. */
-      std::string& Header(){
-	std::string& rhead=headerString;
-	return rhead;
-      };
-
-    private:
-      std::string headerString;    ///< the header string of the block
-      unsigned char *data;         ///< the set of data, stored as unsigned chars
-      Header::SURVEY surveyType;   ///< what type of survey the block deals with
-      Header::SurveySchema survey; ///< how the headers of the survey are defined
-      std::string surveyName;      ///< the name of the survey
-    };
-
-  }
-
-}
-
-#endif /*BLOCK_HH_*/
Index: unk/src/pvo-header.cc
===================================================================
--- /trunk/src/pvo-header.cc	(revision 486)
+++ 	(revision )
@@ -1,290 +1,0 @@
-#include "pvo-header.hh"
-#include <iostream>
-#include <sstream>
-#include <string>
-#include <vector>
-
-using std::string;
-
-namespace PVO
-{
-
-  namespace Header
-  {
-
-    SurveySchema::SurveySchema(const SurveySchema& s)
-    {
-      operator=(s);
-    }
-    //-----------------------------------------------------------------------
-
-    SurveySchema& SurveySchema::operator= (const SurveySchema& s)
-    {
-      if(this == &s) return *this;   // Gracefully handle self assignment
-    
-      for(int i=0;i<numKeywords;i++) this->startPosition[i]  = s.startPosition[i];
-      for(int i=0;i<numKeywords;i++) this->fieldLength[i]    = s.fieldLength[i];
-      for(int i=0;i<numKeywords;i++) this->fieldDimension[i] = s.fieldDimension[i];
-      this->minSamples = s.minSamples;
-      this->ant_x      = s.ant_x;
-      this->ant_y      = s.ant_y;   
-      this->ant_z      = s.ant_z;   
-      this->nrcvr      = s.nrcvr;
-      this->frontend   = s.frontend;
-      this->fd_poln    = s.fd_poln;  
-      this->fd_hand    = s.fd_hand; 
-      this->fd_sang    = s.fd_sang; 
-      this->fd_xyph    = s.fd_xyph; 
-      this->backend    = s.backend; 
-      this->beconfig   = s.beconfig; 
-      this->be_phase   = s.be_phase;
-      this->be_dcc     = s.be_dcc;
-      this->tcycle     = s.tcycle;   
-      this->obs_mode   = s.obs_mode; 
-      this->trk_mode   = s.trk_mode; 
-      this->scanlen    = s.scanlen;  
-      this->fd_mode    = s.fd_mode; 
-      this->cal_mode   = s.cal_mode; 
-      this->cal_freq   = s.cal_freq; 
-      this->cal_dcyc   = s.cal_dcyc; 
-      this->cal_phs    = s.cal_phs;  
-      this->bmaj       = s.bmaj;
-      this->bmin       = s.bmin;
-      this->bpa        = s.bpa;
-      this->pol_type   = s.pol_type;
-      this->npol       = s.npol;
-      this->scale      = s.scale;
-      this->nbin       = s.nbin;
-      this->nbin_prd   = s.nbin_prd;
-      this->phs_offs   = s.phs_offs;
-      this->nsuboffs   = s.nsuboffs;
-
-      return *this;
-    }
-    //--------------------------------------------------------------------------
-
-    SurveySchema::SurveySchema(SURVEY surveyType)
-    {
-      /**
-       * The constructor used to define a setup for a specific survey. The choice
-       *  of survey determines the values of the start and length arrays for 
-       *  each field. If a field does not appear in the header setup for a given
-       *  survey, the start element is set to the RESERVE value, and the length
-       *  is set to 0.
-       * \param surveyType The type of survey, as expressed by the Header::SURVEY
-       * enumeration.
-       */
-
-      // Generic PHU Keywords that are the same for all surveys with PKS.
-      this->ant_x    = -4554231.5;
-      this->ant_y    = 2816759.1;
-      this->ant_z    = -3454036.3;
-
-      this->nrcvr    = 2;
-
-      this->beconfig = "";
-      this->be_phase = 0;  // 0=unknown
-      this->be_dcc   = 0;
-      this->tcycle   = 0;
-      this->obs_mode = "SEARCH";
-      this->trk_mode = "TRACK";
-      this->cal_mode = "OFF"; 
-      this->cal_freq = 0.;
-      this->cal_dcyc = 0.;
-      this->cal_phs  = 0.;
-
-      this->pol_type = "AA+BB";
-      this->npol     = 1;
-
-      this->scale    = "UNCAL";
-    
-      this->nbin     = 1;
-      this->nbin_prd = 1;
-      this->phs_offs = 0.;
-      this->nsuboffs = 0;
-
-      if(surveyType == S70){
-	//=============
-	// 70-cm Survey
-	//=============
-
-	this->minSamples = 512 * 1024;
-
-	this->backend  = "FB_1BIT";
-	this->frontend = "70cm_Cavity_Disk";
-	this->fd_mode  = "FA";
-	this->fd_poln  = "LIN";
-	this->fd_hand  = 1;
-	this->fd_sang  = 0.;
-	this->fd_xyph  = 0.;
-
-	this->bmaj = 0.75;
-	this->bmin = 0.75;
-	this->bpa = 0.;
-
-	this->scanlen = 152.;
-
-	// This initialises the SurveyHeader arrays for the S70 setup.
-	int s70Start[numKeywords] = {0,8,12,16,20,
-				     28,36,44,60,
-				     72,74,90,106,114,
-				     602,602,122,130,138,
-				     202,204,220,228,
-				     252,276,284,292,602,300,
-				     304,320,332,348,364,372,380,388,
-				     396,602,428,492,500,508,
-				     516,598,520,524,536,540,
-				     556,560,568,576,578,584,586,
-				     588,602,602,602,602};
-	for(int i=0;i<numKeywords;i++) this->startPosition[i] = s70Start[i];
-      
-	int s70Length[numKeywords] = {8,4,4,4,8,
-				      8,8,16,12,
-				      2,16,16,8,8,
-				      0,0,8,8,64,
-				      2,8,4,12,
-				      12,4,8,8,0,4,
-				      16,12,16,16,8,8,8,8,
-				      8,0,8,8,8,8,
-				      4,4,4,12,4,16,
-				      2,8,4,2,6,2,2,
-				      10,0,0,0,38};
-	for(int i=0;i<numKeywords;i++) this->fieldLength[i] = s70Length[i];
-
-	int s70Dim[numKeywords] = {1,1,1,1,1,
-				   1,1,1,1,
-				   1,1,1,1,1,
-				   1,1,1,1,1,
-				   1,2,2,2,
-				   2,2,1,1,1,1,
-				   1,1,1,1,1,1,1,1,
-				   4,1,8,1,1,1,
-				   1,1,1,1,1,1,
-				   2,1,2,1,1,1,1,
-				   1,1,1,1,1};
-	for(int i=0;i<numKeywords;i++) this->fieldDimension[i] = s70Dim[i];
-      }
-      else if(surveyType == PM || surveyType == PH){
-	//==================
-	// Multibeam Surveys
-	//==================
-
-	this->minSamples = 2050 * 4096;
-
-	this->backend  = "FB_1BIT";
-	this->frontend = "20cm_MB";
-	this->fd_poln  = "LIN";
-	this->fd_hand  = 1;
-	this->fd_sang  = -90.;
-	this->fd_xyph  = 0.;
-	this->beconfig = "";
-	this->fd_mode  = "CPA";
-	//       this->fa_req  = 30.;
-
-	this->bmaj = 0.24;
-	this->bmin = 0.24;
-	this->bpa = 0.;
-
-	if(surveyType == PM) this->scanlen = 2100.;
-	else                 this->scanlen = 265.;
-
-	// This initialises the SurveyHeader arrays for the PM setup.
-	int pmStart[numKeywords] = {0,6,10,16,20,
-				    28,36,44,60,
-				    72,74,90,106,114,
-				    122,130,618,618,138,
-				    202,204,220,228,
-				    252,276,284,292,300,302,
-				    304,320,332,348,364,372,380,388,
-				    618,396,412,492,500,508,
-				    618,516,520,524,618,540,
-				    556,560,568,576,578,584,586,
-				    588,598,606,614,618};
-	for(int i=0;i<numKeywords;i++) this->startPosition[i] = pmStart[i];
-      
-	int pmLength[numKeywords] = {6,4,6,4,8,
-				     8,8,16,12,
-				     2,16,16,8,8,
-				     8,8,0,0,64,
-				     2,8,4,12,
-				     12,4,8,8,2,1,
-				     16,12,16,16,8,8,8,8,
-				     0,4,4,8,8,8,
-				     0,4,4,16,0,16,
-				     2,8,4,2,6,2,2,
-				     10,8,8,4,22};
-	for(int i=0;i<numKeywords;i++) this->fieldLength[i] = pmLength[i];
-
-	int pmDim[numKeywords] = {1,1,1,1,1,
-				  1,1,1,1,
-				  1,1,1,1,1,
-				  1,1,1,1,1,
-				  1,2,2,2,
-				  2,2,1,1,1,2,
-				  1,1,1,1,1,1,1,1,
-				  1,4,20,1,1,1,
-				  1,1,1,1,1,1,
-				  2,1,2,1,1,1,1,
-				  1,1,1,1,1};
-	for(int i=0;i<numKeywords;i++) this->fieldDimension[i] = pmDim[i];
-      }
-      //     else throw xBadSurvey(surveyType);
-    }
-    //--------------------------------------------------------------------------
-
-    template <class T> 
-    T SurveySchema::readParameter(string headerString, int field,
-				  int elementNumber)
-    {
-      /**
-       * Read a parameter from a certain field in a header string. The function
-       *  is templated, so one can obtain a numerical value or the string
-       *  representation.
-       * \param headerString The character string containing the full header.
-       * \param field The number of the desired header field. Can use the 
-       *  Header::FIELDS enumeration.
-       * \param elementNumber Which element of a multi-valued field to return. 
-       *  Defaults to 0 (ie. the first element).
-       * \return The value of the parameter, in the format in which the function 
-       *  is instantiated.
-       */
-      int dim = this->fieldDimension[field];
-      int length = this->fieldLength[field];
-      int pos = this->startPosition[field];
-      std::stringstream ss;
-      std::vector<T> output(dim);
-      for(int i=0;i<dim;i++){
-	ss.str( headerString.substr(pos+elementNumber*length, length) );
-	ss >> output[i];    
-      }
-      return output[elementNumber];
-    }
-    template <> string 
-    SurveySchema::readParameter<string>(string headerString, 
-					int field, int elementNumber)
-    {
-      //    int dim = this->fieldDimension[field];
-      int length = this->fieldLength[field];
-      int pos = this->startPosition[field];
-      return headerString.substr(pos+elementNumber*length, length);
-    }
-    template int SurveySchema::readParameter<int>(string headerString, 
-						  int field,
-						  int elementNumber);
-    template float SurveySchema::readParameter<float>(string headerString, 
-						      int field,
-						      int elementNumber);
-    template double SurveySchema::readParameter<double>(string headerString, 
-							int field,
-							int elementNumber);
-    template string SurveySchema::readParameter<string>(string headerString, 
-							int field,
-							int elementNumber);
-    //--------------------------------------------------------------------------
-
-
-
-  }
-
-}
-
Index: unk/src/pvo-header.hh
===================================================================
--- /trunk/src/pvo-header.hh	(revision 486)
+++ 	(revision )
@@ -1,216 +1,0 @@
-#ifndef HEADER_HH_
-#define HEADER_HH_
-#include <string>
-#include <iostream>
-#include <fstream>  
-
-namespace PVO
-{
-
-  /** This controls how the headers of existing files are interpreted. */
-  namespace Header
-  {
-    /** Codes for the different surveys.*/
-    enum SURVEY { S70=0, ///< 70-cm Survey (Parkes Southern Pulsar Survey).
-		  PM,    ///< Parkes Multibeam Survey
-		  PH,    ///< Parkes High-Latitude (multibeam) Survey
-		  DUD,   ///< Unknown survey -- this may be a problem!
-		  NONEXISTENT ///< File does not exist.
-    };
-
-    /** Human-readable names for the surveys */
-    const std::string surveyNames[DUD+1] = {
-      "70-cm survey", 
-      "Parkes Multibeam survey", 
-      "Parkes High-latitude survey", 
-      "Not a valid survey" 
-    };
-
-    /**
-     *  What survey does a file contain?
-     *
-     *  Reads the first few bytes of a file, which contain information about
-     *  the type of survey data recorded in the file.
-     *  \param file String with name of the file to be examined.
-     *  \return An enumerated Header::SURVEY type.
-     */
-    inline SURVEY idSurvey(std::string file)
-    {
-      std::ifstream fin;
-      fin.open(file.c_str(), std::ios::binary);
-      if(fin.fail()){
-	fin.close();
-	return NONEXISTENT;
-      }
-      char *hdr = new char[5];
-      fin.read( hdr, 5*sizeof(char) );
-      fin.close();
-      hdr[4] = '\0';
-      unsigned char compstring_s70[5] = {182, 'm', 'm', 219, 0};
-      unsigned char compstring_pm[4] = {'P', 'M', 'D'};
-      compstring_pm[3] = '\0';
-      SURVEY returnval;
-      if(strcmp((const char*)compstring_s70,hdr)==0) returnval = S70;
-      else if(strncmp((const char*)compstring_pm,hdr,3)==0) returnval = PM;
-      else returnval = DUD;
-      delete [] hdr;
-      return returnval;
-    }
-
-    /** Codes for the different moving states. \deprecated */
-    enum ISMOVING { NOTGRID=0, POINT, MOVING, SCANNING };
-
-    /** Codes representing the different header keywords */
-    enum FIELDS 
-      {CODE=0, VERSION, TAPENR, SCAN_CNTR, BLK_CNTR, 
-       DATE, MJD, UT_STRT, LST_STRT, 
-       COORD_TYPE, RA_STRT, DEC_STRT, GL_STRT, GB_STRT, 
-       FEED_ANGLE, OBS_TIME, SCAN_RATE, SCAN_LEN, COMMENT, 
-       NFILTER, CHANBW, NCHAN, FREQ_CHAN1, 
-       SAMP_INT, SAMP_GRP, GRP_BLK, BLK_SEC, FDCNTRL, DATA_TYPE,
-       UT, LST, RA, DEC, GL, GB, TEL_ZEN, TEL_AZ, 
-       STATUS, ATTEN, TPOWER, NBLK_READ, SCAN_RATEL, SCAN_RATEB, 
-       BYTE_GRP, NBEAM, IBEAM, PSRNAME, DATA_TWO, OBS_FILEN, 
-       NBITS, DDM, NDDCH, MOVE, PNTERR, TREE, NSYS, 
-       TELID, PANGLE, SMP_BSW, CAL_CYCLE, RESERVE
-      };
-
-    const int numKeywords = RESERVE + 1; ///< The total number of keywords.
-
-
-    /**
-     * Definitions of the different survey headers.
-     *
-     * This class contains the information needed to make sense of the header
-     *  strings found in the existing survey data files. Each survey has a 
-     *  different header structure, and so this class handles the definitions
-     *  of where one keyword ends and another starts.
-     */
-
-    class SurveySchema
-    {
-    public:
-      SurveySchema(){};
-      virtual ~SurveySchema(){};
-      SurveySchema(SURVEY surveyType); ///< Survey-specific constructor
-      SurveySchema(const SurveySchema& s); ///< Copy constructor
-      SurveySchema& operator= (const SurveySchema& s); ///< Copy constructor.
-
-      /** Get the character number that a given field starts at. */
-      int getStartPosition(int field){return startPosition[field];};
-      /** Get the number of characters in a given field. */
-      int getFieldLength(int field){return fieldLength[field];};
-      /** Get the number of elements that a given field contains. */
-      int getFieldDimension(int field){return fieldDimension[field];};
-
-      template <class T> T readParameter(std::string headerString, int field,
-					 int elementNumber = 0);
-      ///< Read a particular header parameter.
-
-      /** Exception class for a bad survey code. Not used at the moment. */
-      class xBadSurvey{
-      public:
-	xBadSurvey(std::string s){surveyName=s;};
-	virtual ~xBadSurvey(){};
-	std::string getSurvey(){return surveyName;};
-      private:
-	std::string surveyName;
-      };
-
-      long        getMinSamples(){return minSamples;};
-
-      // accessor functions for PHU keyword values -- only get functions needed.
-      double      getAntX(){return ant_x;};
-      double      getAntY(){return ant_y;};
-      double      getAntZ(){return ant_z;};
-      int         getNrcvr(){return nrcvr;};
-      std::string getFrontend(){return frontend;};
-      std::string getFd_poln(){return fd_poln;};
-      int         getFd_hand(){return fd_hand;};
-      float       getFd_sang(){return fd_sang;};
-      float       getFd_xyph(){return fd_xyph;};
-      std::string getBackend(){return backend;};
-      std::string getBeconfig(){return beconfig;};
-      int         getBe_phase(){return be_phase;};
-      int         getBe_dcc(){return be_dcc;};
-      double      getTcycle(){return tcycle;};
-      std::string getObs_mode(){return obs_mode;};
-      std::string getTrk_mode(){return trk_mode;};
-      float       getScanlen(){return scanlen;};
-      std::string getFd_mode(){return fd_mode;};
-      std::string getCal_mode(){return cal_mode;};
-      float       getCal_freq(){return cal_freq;};
-      float       getCal_dcyc(){return cal_dcyc;};
-      float       getCal_phs(){return cal_phs;};
-      float       getBmaj(){return bmaj;};
-      float       getBmin(){return bmin;};
-      float       getBpa(){return bpa;};
-      std::string getPolType(){return pol_type;};
-      int         getNPol(){return npol;};
-      std::string getScale(){return scale;};
-      int         getNbin(){return nbin;};
-      void        setNbin(int i){nbin=i;};
-      int         getNbin_prd(){return nbin_prd;};
-      void        setNbin_prd(int i){nbin_prd=i;};
-      float       getPhs_offs(){return phs_offs;};
-      void        setPhs_offs(float i){phs_offs=i;};
-      int         getNsuboffs(){return nsuboffs;};
-      void        setNsuboffs(int i){nsuboffs=i;};
- 
-    private:
-      int startPosition[numKeywords];  ///< The character number at
-      ///   which each field commences.
-      int fieldLength[numKeywords];    ///< The number of characters in
-      ///   each field.
-      int fieldDimension[numKeywords]; ///< The number of elements in
-      ///   each field.
-
-      long        minSamples;  ///< The minimum number of samples to be
-      ///   included in a FITS file
-
-      // The following are PHU keywords that are survey-dependent.
-      double      ant_x;
-      double      ant_y;
-      double      ant_z;
-      int         nrcvr;
-      std::string frontend;
-      std::string fd_poln;
-      int         fd_hand;
-      float       fd_sang;
-      float       fd_xyph;
-      std::string backend;
-      std::string beconfig;
-      int         be_phase;
-      int         be_dcc;
-      double      tcycle;
-      std::string obs_mode;
-      std::string trk_mode;
-      float       scanlen;
-      std::string fd_mode;
-      std::string cal_mode;
-      float       cal_freq;
-      float       cal_dcyc;
-      float       cal_phs;
-
-      float       bmaj;
-      float       bmin;
-      float       bpa;
-
-      // the following go in the HISTORY and SUBINT tables
-      std::string pol_type;
-      int         npol;
-      std::string scale;
-      int         nbin;
-      int         nbin_prd;
-      float       phs_offs;
-      int         nsuboffs;
-
-    };
-
-    // Inline functions
-
-  }
-
-}
-
-#endif /*HEADER_HH_*/
Index: unk/src/pvo-metadata.cc
===================================================================
--- /trunk/src/pvo-metadata.cc	(revision 486)
+++ 	(revision )
@@ -1,640 +1,0 @@
-#include <iostream>
-#include <sstream>
-#include <iomanip>
-#include <vector>
-#include <string>
-#include <stdlib.h>
-#include <unistd.h>
-#include <math.h>
-#include <sys/stat.h>
-#include "pvo.hh"
-#include "pvo-metadata.hh"
-#include "pvo-FITS.hh"
-#include "pvo-utils.hh"
-
-namespace PVO
-{
-
-  namespace Meta
-  {
-
-    Metadata::Metadata(){
-      sepFlag=false; 
-      angsep=nullFloat;
-    }
-
-    Metadata::~Metadata()
-    {
-    }
-
-    Metadata::Metadata(const Metadata& m)
-    {
-      filename        = m.filename      ;
-      fileloc	      = m.fileloc	      ;
-      headerversion   = m.headerversion ;
-      file_size_bytes = m.file_size_bytes;
-      survey	      = m.survey	      ;
-      srcname	      = m.srcname	      ;
-      telescope	      = m.telescope     ;	    
-      data_type	      = m.data_type     ;	    
-      raj	      = m.raj	      ;
-      decj	      = m.decj	      ;
-      rajd	      = m.rajd	      ;
-      decjd	      = m.decjd	      ;
-      gl	      = m.gl	      ;
-      gb	      = m.gb	      ;
-      date	      = m.date	      ;
-      beamsize	      = m.beamsize      ;	    
-      bmaj	      = m.bmaj	      ;
-      bmin	      = m.bmin	      ;
-      bpa	      = m.bpa	      ;
-      mjd	      = m.mjd	      ;
-      obsfreq	      = m.obsfreq	      ;
-      tsamp	      = m.tsamp	      ;
-      scanlen	      = m.scanlen	      ;
-      nbits	      = m.nbits	      ;
-      nchan	      = m.nchan	      ;
-      npol 	      = m.npol	      ;
-      nbin 	      = m.nbin	      ;
-      nsub	      = m.nsub	      ;
-      chanbw	      = m.chanbw	      ;
-      angsep	      = m.angsep	      ;
-      sepFlag         = m.sepFlag       ;
-
-    }
-
-    Metadata& Metadata::operator= (const Metadata& m)
-    {
-      if(this == &m) return *this;   // Gracefully handle self assignment
-      this->filename      = m.filename      ;
-      this->fileloc	    = m.fileloc	      ;
-      this->file_size_bytes = m.file_size_bytes;
-      this->headerversion = m.headerversion ;
-      this->survey	    = m.survey	      ;
-      this->srcname	    = m.srcname	      ;
-      this->telescope	    = m.telescope     ;	    
-      this->data_type	    = m.data_type     ;	    
-      this->raj	    = m.raj	      ;
-      this->decj	    = m.decj	      ;
-      this->rajd	    = m.rajd	      ;
-      this->decjd	    = m.decjd	      ;
-      this->gl	    = m.gl	      ;
-      this->gb	    = m.gb	      ;
-      this->date	    = m.date	      ;
-      this->beamsize	    = m.beamsize      ;	    
-      this->bmaj	    = m.bmaj	      ;
-      this->bmin	    = m.bmin	      ;
-      this->bpa	    = m.bpa	      ;
-      this->mjd	    = m.mjd	      ;
-      this->obsfreq	    = m.obsfreq	      ;
-      this->tsamp	    = m.tsamp	      ;
-      this->scanlen	    = m.scanlen	      ;
-      this->nbits	    = m.nbits	      ;
-      this->nchan	    = m.nchan	      ;
-      this->npol 	    = m.npol	      ;
-      this->nbin 	    = m.nbin	      ;
-      this->nsub	    = m.nsub	      ;
-      this->chanbw	    = m.chanbw	      ;
-      this->angsep	    = m.angsep	      ;
-      this->sepFlag        = m.sepFlag       ;
-
-      return *this;
-    }
-    
-    
-
-    void Metadata::define(FITS::PSRFits fitsfile)
-    {
-      /**
-       * Define a set of metadata.
-       *
-       * This takes a FITS file and reads in all desired metadata
-       * fields from it. If certain fields are not present, the
-       * appropriate NULL value is recorded (such as Meta::nullString
-       * or Meta::nullFloat).
-       *
-       * \param fitsfile The PSRFits object containing the FITS file
-       *                  information.
-       */
-
-      this->filename = fitsfile.getFITSname();
-
-      int pos = this->filename.find("_");
-      std::string extension="";
-      std::string surveyStr = this->filename.substr(0,pos);
-      size_t dot = this->filename.rfind('.');
-      if(dot!=std::string::npos) 
-	extension = this->filename.substr(dot,this->filename.size());
-      this->survey = nullString;
-      if(extension == ".sf"){
-	if(surveyStr == "S70") this->survey = "PKS70";
-	else if(surveyStr == "PM") this->survey = "PM";
-	else if(surveyStr == "PH") this->survey = "PH";
-      }
-
-      int cwdSize=200;
-      char *cwd = new char[200];
-      if(this->filename[0]!='/'){ 
-	// if the directory doesn't start with a /, it is the current
-	// directory.
-	getcwd(cwd,cwdSize);
-	this->fileloc = cwd;
-// 	this->fileloc += "/";
-      }
-      //      this->fileloc += this->filename;
-
-//       std::stringstream sysmsg;
-//       sysmsg << "du -kL " << this->fileloc << "/" << this->filename << " | awk '{print $1}' > /tmp/size";
-//       system(sysmsg.str().c_str());
-//       std::ifstream fin("/tmp/size");
-//       fin >> this->file_size_bytes;
-//       this->file_size_bytes *= 1024;
-//       fin.close();      
-//       system("rm -f /tmp/size");
-
-      struct stat file_status;
-      if(stat(this->filename.c_str(),&file_status) != 0 ){
-	std::stringstream errmsg;
-	errmsg << "Could not obtain file size for " << this->filename << "\n";
-	PVOError("Metadata::define",errmsg.str());
-      }
-      this->file_size_bytes = file_status.st_size;
-
-      fitsfile.gotoPHU();
-
-      if(fitsfile.getKeyword<std::string>("HDRVER",this->headerversion)!=0) 
-	this->headerversion = nullString;
-      this->headerversion = deblank(this->headerversion);
-
-      if(fitsfile.getKeyword<std::string>("SRC_NAME",this->srcname)!=0) 
-	this->srcname = nullString;
-      else this->srcname = deblank(this->srcname);
-      if(this->srcname=="") this->srcname = nullString;
-
-      if(fitsfile.getKeyword<std::string>("TELESCOP",this->telescope)!=0) 
-	this->telescope = nullString;
-      else this->telescope = deblank(this->telescope);
-      if(this->telescope=="") this->telescope = nullString;
-
-      if(fitsfile.getKeyword<std::string>("BACKEND",this->data_type)!=0) 
-	this->data_type = nullString;
-      else this->data_type = deblank(this->data_type);
-      if(this->data_type=="") this->data_type = nullString;
-
-      if(fitsfile.getKeyword<std::string>("RA",this->raj)!=0) 
-	this->raj = nullString;
-      else this->rajd = dmsToDec(this->raj) * 15.;
-
-      if(fitsfile.getKeyword<std::string>("DEC",this->decj)!=0) 
-	this->decj = nullString;
-      else this->decjd = dmsToDec(this->decj);
-
-      if(this->raj != nullString && this->decj != nullString)
-	equatToGal(this->rajd,this->decjd, this->gl, this->gb);
-      else
-	this->gl = this->gb = nullFloat;
-
-      if(fitsfile.getKeyword<std::string>("DATE-OBS",this->date)!=0) 
-	this->date = nullString;
-
-      if(fitsfile.getKeyword<double>("OBSFREQ",this->obsfreq)!=0) 
-	this->obsfreq = nullFloat;
-  
-      if(fitsfile.getKeyword<float>("BMAJ",this->bmaj)==0){
-	fitsfile.getKeyword<float>("BMIN",this->bmin);
-	fitsfile.getKeyword<float>("BPA",this->bpa);
-	this->beamsize = 0.5*(bmaj+bmin); 
-      }
-      else this->bmaj = this->bmin = this->bpa = this->beamsize = nullFloat;
-
-      if(fitsfile.getKeyword<float>("SCANLEN",this->scanlen)!=0) 
-	this->scanlen = nullFloat;
-
-      float imjd,smjd;
-      if(fitsfile.getKeyword<float>("STT_IMJD",imjd)!=0) 
-	this->mjd = nullFloat;
-      else{
-	fitsfile.getKeyword<float>("STT_SMJD",smjd);
-	this->mjd = imjd + smjd / (24.*3600.);
-      }
-
-      ////////////////////
-      // From here, we get information from the HISTORY table.
-      fitsfile.gotoHistory();
-
-      if(fitsfile.readColumnValue("NCHAN",1,&this->nchan)!=0) 
-	this->nchan = nullInt;
-      if(this->nchan == 0) this->nchan = nullInt;
-
-      if(fitsfile.readColumnValue("CHAN_BW",1,&this->chanbw)!=0) 
-	this->chanbw = nullFloat;
-      if(!(fabs(this->chanbw)>0.)) this->chanbw = nullFloat; // only set to null if it is zero.
-
-      ////////////////////
-      // From here, we get information from the SUBINT table.
-      fitsfile.gotoSubint();
-      // TSAMP in seconds.
-      //      if(fitsfile.readColumnValue("TBIN",1,&this->tbin)!=0) 
-      if(fitsfile.getKeyword<float>("TSAMP",this->tsamp)!=0) 
-	this->tsamp = nullFloat;
-      if(!(this->tsamp>0.)) this->tsamp = nullFloat;
-
-      // number of bins
-      if(fitsfile.getKeyword<int>("NBIN",this->nbin)!=0) 
-	this->nbin = nullInt;
-      if(!(this->nbin>0.)) this->nbin = nullInt;
-
-      // number of polarisations
-      if(fitsfile.getKeyword<int>("NPOL",this->npol)!=0) 
-	this->npol = nullInt;
-      if(!(this->npol>0.)) this->npol = nullInt;
-
-      // number of bits
-      if(fitsfile.getKeyword<int>("NBITS",this->nbits)!=0) 
-	this->nbits = nullInt;
-      if(!(this->nbits>0.)) this->nbits = nullInt;
-
-      // number of subintegrations
-      if(fitsfile.getKeyword<int>("NAXIS2",this->nsub)!=0) 
-	this->nsub = nullInt;
-      if(!(this->nsub>0.)) this->nsub = nullInt;
-
-
-    }
-    //----------------------------------------------------
-    void Metadata::setAngSep(float ra, float dec)
-    {
-      /**
-       * Set the value of the Metadata::angsep parameter, being the
-       * angular separation from a given (ra, dec) position, in
-       * degrees.
-       *
-       * \param ra The right ascension of the base position.
-       * \param dec The declination of the base position.
-       */ 
-      this->angsep = angSep(ra, dec, rajd, decjd); 
-      this->sepFlag=true;
-    }
-    //----------------------------------------------------
-
-    bool Metadata::close(float radius)
-    {
-      /**
-       * Uses the metadata quantity Meta::Metadata::angsep to
-       * determine if the current object is within the given radius of
-       * some position. The angsep quantity needs to have been defined
-       * previously.
-       *
-       * \param radius The maximum separation, in degrees, that will
-       *                return true.
-       * \return True if angsep is less than the radius plus half the
-       *          beamsize. False otherwise.
-       */
-      if(this->angsep < 0.) return false;
-      else return (this->angsep < (radius + 0.5*this->beamsize));
-    }
-    //----------------------------------------------------
-
-    bool Metadata::close(float ra, float dec, float radius)
-    {
-      /**
-       * Determines whether the current object is within the given
-       * radius of a given position. This function defines the
-       * Metadata::angsep quantity in the process. 
-       *
-       * \param ra The right ascension of the base position.
-       * \param dec The declination of the base position.
-       * \param radius The maximum separation, in degrees, from the
-       *                base position that will return true.
-       * \return True if angsep is less than the radius plus half the
-       *          beamsize. False otherwise.
-       */
-      this->setAngSep(ra,dec);
-      return (angsep < (radius+0.5*this->beamsize));
-    }
-    //----------------------------------------------------
-
-    std::string floatToString(float f)
-    {
-      /**
-       *  Convert a float value to a string, using the default
-       *  precision of Meta::fltwidth. If the value is null, return
-       *  the null string.
-       *  \param f The float value.
-       *  \return A string showing the value, or the null string if
-       *           appropriate.
-       */
-      if(f > nullFloat){
-	std::stringstream ss;
-	ss << std::fixed << std::setprecision(fltwidth) << f;
-	return ss.str();
-      }
-      else return nullString;
-    }
-    //----------------------------------------------------
-
-    std::string doubleToString(double d)
-    {
-      /**
-       *  Convert a double value to a string, using the default
-       *  precision of Meta::dubwidth. If the value is null, return
-       *  the null string.
-       *  \param d The double value.
-       *  \return A string showing the value, or the null string if
-       *           appropriate.
-       */
-      if(d > nullFloat){
-	std::stringstream ss;
-	ss << std::fixed << std::setprecision(dubwidth) << d;
-	return ss.str();
-      }
-      else return nullString;
-    }
-    //----------------------------------------------------
-
-    std::string doubleToString(double d, int prec)
-    {
-      /**
-       *  Convert a double value to a string, using the precision of
-       *  prec. If the value is null, return the null string.
-       *  \param d The double value.
-       *  \param prec The desired precision.
-       *  \return A string showing the value, or the null string if
-       *           appropriate.
-       */
-      if(d > nullFloat){
-	std::stringstream ss;
-	ss << std::fixed << std::setprecision(prec) << d;
-	return ss.str();
-      }
-      else return nullString;
-    }
-    //----------------------------------------------------
-
-    std::string intToString(int i)
-    {
-      /**
-       *  Convert an int value to a string. If the value is null,
-       *  return the null string.
-       *  \param i The int value.
-       *  \return A string showing the value, or the null string if
-       *           appropriate.
-       */
-      if(i > nullInt){
-	std::stringstream ss;
-	ss << i;
-	return ss.str();
-      }
-      else return nullString;
-    }
-    //----------------------------------------------------
-
-    void printMetadataShort(std::ostream &theStream, Metadata data)
-    {
-      /**
-       * A front-end to printMetadataShort(std::ostream,
-       * std::vector<Metadata>).
-       */
-      std::vector<Metadata> datalist;
-      datalist.push_back(data);
-      printMetadataShort(theStream, datalist);
-    }
-    //----------------------------------------------------
-
-    void printMetadataShort(std::ostream &theStream, std::vector<Metadata> datalist)
-    {
-      /**
-       * Prints out the summary list of metadata to the desired
-       * ostream. The summary list is a short list of columns,
-       * designed for easy reading on a terminal. The columns are:
-       * FILENAME, SRC_NAME, RAJ, DECJ, BEAM FWHM, OBSFREQ, SCANLEN,
-       * DATE-OBS. The widths of the columns are fixed, except for the
-       * first two, which expand in size to fit the data.
-       *
-       * \param theStream Where the data should be printed.
-       * \param datalist The vector of Metadata objects that describe
-       *                  the metadata.
-       */
-      int filenameSize = 8; // size of "FILENAME"
-      int srcNameSize = 8;  // size of "SRC_NAME"
-      int width;
-      unsigned int i;
-      bool showSep = false;
-      if(datalist.size()>0){
-	showSep = datalist[0].showSep();
-      }
-      for(i=0;i<datalist.size();i++){
-	filenameSize = std::max(filenameSize,
-				int(datalist[i].getFilename().size()));
-	srcNameSize = std::max(srcNameSize,
-			       int(datalist[i].getSrcname().size()));
-      }
-      width = filenameSize+srcNameSize+2+15+15+31+11+11+11;
-
-      theStream << std::setfill('-')  
-		<< std::setw(width) << "-";
-      if(showSep) theStream << std::setw(13) << "-";
-      
-      theStream << "\n" << std::setfill(' ') 
-		<< std::setw(filenameSize) << "FILENAME"  << " "
-		<< std::setw(srcNameSize)  << "SRC_NAME"  << " "
-		<< std::setw(14)           << "RAJ"       << " "
-		<< std::setw(14)           << "DECJ"      << " "
-		<< std::setw(10)           << "BEAM FWHM" << " "
-		<< std::setw(10)           << "OBSFREQ"   << " "
-		<< std::setw(10)           << "SCANLEN"   << " "
-		<< std::setw(30)           << "DATE-OBS";
-      if(showSep)
-	theStream  << " " << std::setw(12) << "OFFSET"    << "\n";
-      else theStream << "\n";
-
-      theStream << std::setw(filenameSize) << ""          << " "
-		<< std::setw(srcNameSize)  << ""          << " "
-		<< std::setw(14)           << "[deg]"     << " "
-		<< std::setw(14)           << "[deg]"     << " "
-		<< std::setw(10)           << "[deg]"     << " "
-		<< std::setw(10)           << "[MHz]"     << " "
-		<< std::setw(10)           << "[s]"       << " "
-		<< std::setw(30)           << "";
-      if(showSep)
-	theStream << " " << std::setw(12)  << "[deg]" << "\n";
-      else  theStream << "\n";
-
-      theStream << std::setfill('-')  
-		<< std::setw(width) << "-";
-      if(showSep) theStream << std::setw(13) << "-";
-      theStream << "\n"<< std::setfill(' ') ;
-    
-      for(i=0;i<datalist.size();i++){
-
-	theStream << std::setw(filenameSize) 
-		  << datalist[i].getFilename() << " ";
-	theStream << std::setw(srcNameSize) 
-		  << datalist[i].getSrcname() << " ";
-
-	if(datalist[0].showSep())
-	  theStream << std::setprecision(6)
-		    << std::setw(14)<< datalist[i].getRaD() << " "
-		    << std::setw(14)<< datalist[i].getDecD()<< " ";
-	else
-	  theStream << std::setw(14)<< datalist[i].getRaS() << " "
-		    << std::setw(14)<< datalist[i].getDecS()<< " ";
-
-	theStream << std::setprecision(4)
-		  << std::setw(10)<< floatToString(datalist[i].getBeamsize())<< " "
-		  << std::setw(10)<< doubleToString(datalist[i].getObsfreq()) << " "
-		  << std::setw(10)<< floatToString(datalist[i].getScanlen()) << " "
-		  << std::setw(30)<< datalist[i].getDate();
-
-	if(datalist[0].showSep()) 
-	  theStream << " " 
-		    << std::setw(12)<< floatToString(datalist[i].getAngSep())<< "\n";
-	else theStream << "\n";
-	
-      }
-
-
-    }
-    //----------------------------------------------------
-
-    void printMetadataFull(std::string filename, Metadata data)
-    {
-      /**
-       * A front-end to printMetadataFull(std::string,
-       * std::vector<Metadata>).
-       */
-      std::vector<Metadata> datalist;
-      datalist.push_back(data);
-      printMetadataFull(filename, datalist);
-    }
-    //----------------------------------------------------
-
-    std::string enclose(std::string input)
-    {
-      std::string output;
-      if(input == nullString) output = nullString;
-      else output = "\"" + input + "\"";
-      return output;
-    }
-
-    void printMetadataFull(std::string filename, std::vector<Metadata> datalist)
-    {
-      /**
-       * Prints out the full list of metadata for a set of objects to
-       * the desired file given by filename. The metadata are printed
-       * in csv (comma-separated values) format, and all metadata are
-       * printed.
-       *
-       * \param filename The name of the file to which the data should
-       *                  be printed.
-       * \param datalist The vector of Metadata objects that describe
-       *                  the metadata.
-       */
-      std::ofstream fileout(filename.c_str());
-
-      unsigned int i;
-    
-      fileout << "Filename,"
-	      << "\"Source Name\","
-	      << "\"Project ID\","
-	      << "RAJ,"
-	      << "DECJ,"
-	      << "Data_type,"
-	      << "Obsfreq,"
-	      << "ChanBW,"
-	      << "\"Scan length\","
-	      << "\"UT Date\","
-	      << "\"UT Time\","
-	      << "MJD,"
-	      << "RAJd,"
-	      << "DECJd,"
-	      << "GL,"
-	      << "GB,"
-	      << "BMAJ,"
-	      << "BMIN,"
-	      << "BPA,"
-	      << "DM,"
-	      << "Period,"
-	      << "NChan,"
-	      << "NPol,"
-	      << "NBin,"
-	      << "NSub,"
-	      << "Tsamp,"
-	      << "Nbits,"
-	      << "Nbeam"
-	      << "Config,"
-	      << "Instrument,"
-	      << "Receiver,"
-	      << "\"Header version\","
-	      << "Survey,"
-	      << "Telescope,"
-	      << "Site,"
-	      << "Observers,"
-	      << "\"File Location\","
-	      << "File_size_bytes,"
-;
-	    
-      if(datalist[0].showSep())	fileout  << ",Offset\n";
-      else fileout << "\n";
-     
-      for(i=0;i<datalist.size();i++){
-
-	std::string date,time,obsdate;
-	obsdate = datalist[i].getDate();
-	size_t tloc = obsdate.find('T');
-	date = obsdate.substr(0,tloc);
-	time = obsdate.substr(tloc+1,obsdate.size()-tloc);
-
-	fileout << enclose(datalist[i].getFilename() )      << ","
-		<< enclose(datalist[i].getSrcname())        << ","
-		<< nullString                               << "," //project_id
-		<< enclose(datalist[i].getRaS())            << ","
-	       	<< enclose(datalist[i].getDecS())           << ","
-		<< enclose(datalist[i].getDataType())       << ","
-		<< doubleToString(datalist[i].getObsfreq()) << ","
-		<< floatToString(datalist[i].getChanbw())   << ","
-		<< floatToString(datalist[i].getScanlen())  << ","
-		<< date                                     << ","
-		<< time                                     << ","
-		<< doubleToString(datalist[i].getMJD())     << ","
-	        << std::fixed << std::setprecision(6)
-	       	<< doubleToString(datalist[i].getRaD(),6)   << ","
-	       	<< doubleToString(datalist[i].getDecD(),6)  << ","
-	       	<< doubleToString(datalist[i].getGL(),6)    << ","
-	       	<< doubleToString(datalist[i].getGB(),6)    << ","
-		<< floatToString(datalist[i].getBmaj())     << ","
-		<< floatToString(datalist[i].getBmin())     << ","
-		<< floatToString(datalist[i].getBpa())      << ","
-		<< nullString                               << "," // DM
-		<< nullString                               << "," // Period
-		<< intToString(datalist[i].getNchan())      << ","
-		<< intToString(datalist[i].getNpol())       << ","
-		<< intToString(datalist[i].getNbin())       << ","
-		<< intToString(datalist[i].getNsub())       << ","
-		<< floatToString(datalist[i].getTsamp())    << ","
-		<< intToString(datalist[i].getNbits())      << ","
-		<< 1                                        << "," //nbeam      
-		<< nullString                               << "," // Config
-		<< enclose(datalist[i].getDataType())       << "," // Instrument
-		<< nullString                               << "," // Receiver
-		<< enclose(datalist[i].getHeaderVersion())  << ","
-		<< enclose(datalist[i].getSurvey())         << ","
-		<< enclose(datalist[i].getTelescope())      << ","
-		<< nullString                               << "," // site
-		<< nullString                               << "," // Observers
-		<< enclose(datalist[i].getFileloc())        << ","
-	        << datalist[i].getFileSize();
-
-	if(datalist[0].showSep()) 
-	  fileout << "," << floatToString(datalist[i].getAngSep()) << "\n";
-	else fileout << "\n";
-
-      }
-
-      fileout.close();
-
-    }
-
-  }// end namespace Meta
-
-} // end namespace PVO
Index: unk/src/pvo-metadata.hh
===================================================================
--- /trunk/src/pvo-metadata.hh	(revision 486)
+++ 	(revision )
@@ -1,197 +1,0 @@
-#ifndef PSRMETADATA_HH_
-#define PSRMETADATA_HH_
-#include <fitsio.h>
-#include <string>
-#include "pvo.hh"
-#include "pvo-FITS.hh"
-#include "pvo-utils.hh"
-
-namespace PVO
-{
-
-  namespace Meta
-  {
-
-    /** The precision for printing floats */
-    const int   fltwidth=4;
-    /** The precision for printing doubles */
-    const int   dubwidth=6;
-
-    std::string doubleToString(double d);
-    std::string doubleToString(double d, int prec);
-    std::string floatToString(float f);
-    std::string intToString(int i);
-
-    /** The information used by "pvosummary -p" */
-    const std::string metadataList=
- "List of parameters used in pvosummary.\n\n\
-Basic parameters written to screen:\n\
- FILENAME       The FITS file.\n\
- SRC_NAME       The SRC_NAME FITS keyword.\n\
- RAJ            Right Ascension, hh:mm:ss.ss\n\
- DECJ           Declination, dd:mm:ss.sss \n\
- BEAM FWHM      The average full-width-half-maximum of the beam\n\
-                 (averaged between BMAJ and BMIN)\n\
- OBSFREQ        The central observing frequency\n\
- DATE-OBS       The UT time and date of the observation, in FITS\n\
-                 format YYYY-MM-DDThh:mm:ss.ssss\n\n\
-Additional parameters included only in csv file:\n\
- File Location  The full path of the FITS file.\n\
- Header Version The version of the PSRFITS definition used.\n\
- Survey         Which survey the data comes from:\n\
-                  left blank if not known or not a survey file (e.g. .rf files).\n\
- Source Name    The SRC_NAME FITS keyword (printed as SRC_NAME to screen).\n\
- Telescope      Where the observations were made.\n\
- Data_type      The type of data -- usually the backend instrument used.\n\
- RAJd           Right Ascension, in decimal degrees.\n\
- DecJd          Declination, in decimal degrees.\n\
- GL             Galactic Longitude, in degrees.\n\
- GB             Galactic Latitude, in degrees.\n\
- BMAJ           The FWHM of the major axis of the beam.\n\
- BMIN           The FWHM of the minor axis of the beam.\n\
- BPA            The position angle of the beam.\n\
- MJD            The Modified Julian Date of the start of the observation.\n\
- ChanBW         The channel bandwidth (from the HISTORY table).\n\
- Nchan          Number of channels (from the HISTORY table).\n\
- Scan length    The SCANLEN keyword.\n\
- Tsamp          Time per sample [ms] (from the SUBINT table).\n\
- NBits          Number of bits per datum (from the SUBINT table).\n";
- 
-
-    /**
-     * The namespace to record only relevant details about a PSRFITS
-     * file, that can be used by the utility programs pvosummary and
-     * pvoconesearch.
-     */
-    class Metadata
-    {
-    public:
-      Metadata();
-      virtual ~Metadata();
-      Metadata(const Metadata& m);
-      Metadata& operator= (const Metadata& m);
-
-      void        define(FITS::PSRFits fitsfile);
-      friend bool operator< (Metadata lhs, Metadata rhs){
-	return (lhs.angsep < rhs.angsep);
-      };
-
-      void        setAngSep(float ra, float dec);
-      bool        close(float radius);
-      bool        close(float ra, float dec, float radius);
-
-      std::string getFilename(){return filename;};
-      void        setFilename(std::string s){filename=s;};
-      std::string getFileloc(){return fileloc;};
-      void        setFileloc(std::string s){fileloc=s;};
-      int         getFileSize(){return file_size_bytes;};
-      void        setFileSize(int i){file_size_bytes=i;};
-      std::string getSurvey(){return survey;};
-      void        setSurvey(std::string s){survey=s;};
-      std::string getHeaderVersion(){return headerversion;};
-      void        setHeaderVersion(std::string s){headerversion=s;};
-      std::string getSrcname(){return srcname;};
-      void        setSrcname(std::string s){srcname=s;};
-      std::string getTelescope(){return telescope;};
-      void        setTelescope(std::string s){telescope=s;};
-      std::string getDataType(){return data_type;};
-      void        setDataType(std::string s){data_type=s;};
-      std::string getRaS(){return raj;};
-      void        setRaS(std::string s){raj=s;};
-      std::string getDecS(){return decj;};
-      void        setDecS(std::string s){decj=s;};
-      double      getRaD(){return rajd;};
-      void        setRaD(double d){rajd=d;};
-      double      getDecD(){return decjd;};
-      void        setDecD(double d){decjd=d;};
-      std::string getDate(){return date;};
-      void        setDate(std::string s){date=s;};
-      double      getGL(){return gl;};
-      void        setGL(double d){gl=d;};
-      double      getGB(){return gb;};
-      void        setGB(double d){gb=d;};
-      float       getBeamsize(){return beamsize;};
-      void        setBeamsize(float f){beamsize=f;};
-      float       getBmaj(){return bmaj;};
-      void        setBmaj(float f){bmaj=f;};
-      float       getBmin(){return bmin;};
-      void        setBmin(float f){bmin=f;};
-      float       getBpa(){return bpa;};
-      void        setBpa(float f){bpa=f;};
-      double      getMJD(){return mjd;};
-      void        setMJD(double d){mjd=d;};
-      double      getObsfreq(){return obsfreq;};
-      void        setObsfreq(double d){obsfreq=d;};
-      float       getTsamp(){return tsamp;};
-      void        setTsamp(float f){tsamp=f;};
-      int         getNbits(){return nbits;};
-      void        setNbits(int i){nbits=i;};
-      float       getScanlen(){return scanlen;};
-      void        setScanlen(float f){scanlen=f;};
-      int         getNchan(){return nchan;};
-      void        setNchan(int i){nchan=i;};
-      int         getNpol(){return npol;};
-      void        setNpol(int i){npol=i;};
-      int         getNbin(){return nbin;};
-      void        setNbin(int i){nbin=i;};
-      int         getNsub(){return nsub;};
-      void        setNsub(int i){nsub=i;};
-      float       getChanbw(){return chanbw;};
-      void        setChanbw(float f){chanbw=f;};
-      float       getAngSep(){if(sepFlag) return angsep; else return -1.;};
-      void        setAngSep(float f){angsep=f; sepFlag=true;};
-      bool        showSep(){return sepFlag;};
-      void        setSep(bool b){sepFlag=b;};
-
-      std::string getBeamsizeS();
-      std::string getObsfreqS();
-      std::string getTbinS();
-      std::string getAngSepS();
-
-    private:
-      std::string filename;
-      std::string fileloc;
-      int         file_size_bytes;
-      std::string headerversion;
-      std::string survey;
-      std::string srcname;
-      std::string telescope;
-      std::string data_type;
-      std::string raj;
-      std::string decj;
-      double      rajd;
-      double      decjd;
-      double      gl;
-      double      gb;
-      std::string date;
-      float       beamsize;
-      float       bmaj;
-      float       bmin;
-      float       bpa;
-      double      mjd;
-      double      obsfreq;
-      float       tsamp;
-      float       scanlen;
-      int         nbits;
-      int         nchan;
-      int         npol;
-      int         nbin;
-      int         nsub;
-      float       chanbw;
-      float       angsep;
-      bool        sepFlag;
-    };
-
-    /** Print summary of a set of metadata to a stream */
-    void printMetadataShort(std::ostream &theStream, Metadata data);
-    /** Print summary of a list of metadata sets to a stream */
-    void printMetadataShort(std::ostream &theStream, std::vector<Metadata> datalist);
-    /** Print an entire set of metadata to a stream */
-    void printMetadataFull(std::string filename, Metadata data);
-    /** Print the full set of a list of metadata sets to a stream */
-    void printMetadataFull(std::string filename, std::vector<Metadata> datalist);
-
-  }
-}
-
-#endif //PSRSUMMARY_HH_
Index: unk/src/pvo-utils.cc
===================================================================
--- /trunk/src/pvo-utils.cc	(revision 486)
+++ 	(revision )
@@ -1,533 +1,0 @@
-#include "pvo-utils.hh"
-#include <time.h>
-#include <stdlib.h>
-#include <math.h>
-#include <string>
-#include <glob.h>
-#include <iostream>
-#include <sstream>
-#include <iomanip>
-
-namespace PVO
-{
-
-  std::string getPSRFITSdefn(){ 
-    return getenv("PSRFITSDEFN"); 
-  }
-
-  void PVOError(std::string subroutine, std::string error)
-  {
-    /**
-     * Prints an ERROR message to the standard error stream, quoting
-     * the subroutine that the problem occurred in, a descriptive
-     * warning text, and sounding the bell.
-     *
-     * Format: ERROR \<function\> : Something bad happened.
-     */
-    std::string preamble = "\aERROR <" + subroutine + "> : ";
-    std::cerr << preamble;
-    for(unsigned int i=0;i<error.size();i++){
-      std::cerr << error[i];
-      if((i!=error.size()-1)&&(error[i]=='\n'))
-	std::cerr << std::setw(preamble.size()-1) <<": ";
-    }
-  }
-  //------------------------------------------------------------
-
-  std::vector<std::string> getAllFitsFiles()
-  {
-    std::vector<std::string> namelist;
-    glob_t list1,list2,list3;
-    unsigned int i;
-
-    list1.gl_offs = 0;
-    list2.gl_offs = 0;
-    list3.gl_offs = 0;
-
-    glob("*.fits", GLOB_DOOFFS, NULL, &list1);
-    glob("*.rf", GLOB_DOOFFS, NULL, &list2);
-    glob("*.sf", GLOB_DOOFFS, NULL, &list3);
-
-    namelist.resize(list1.gl_pathc+list2.gl_pathc+list3.gl_pathc);
-    for(i=0;i<list1.gl_pathc+list1.gl_offs;i++) 
-      namelist[i] = list1.gl_pathv[i];
-    for(i=0;i<list2.gl_pathc+list2.gl_offs;i++) 
-      namelist[list1.gl_pathc+i] = list2.gl_pathv[i];
-    for(i=0;i<list3.gl_pathc+list3.gl_offs;i++) 
-      namelist[list1.gl_pathc+list2.gl_pathc+i] = list3.gl_pathv[i];
-    
-    return namelist;
-  }
-
-  //------------------------------------------------------------
-
-  std::string removeLeadingBlanks(std::string s)
-  {
-    /**
-     * All blank spaces from the start of the string to the first
-     * non-blank-space character are deleted.
-     */ 
-    int i=0;
-    while(s[i]==' '){
-      i++;
-    }
-    std::string newstring;
-    for(unsigned int j=i;j<s.size();j++) newstring += s[j];
-    return newstring;
-  }
-  //------------------------------------------------------------------------
-
-  std::string deblank(std::string s)
-  {
-    /**
-     * All blank spaces from the start of the string to the first
-     * non-blank-space character, and from the last non-blank-space
-     * character to the end are deleted.
-     */ 
-    int beg=0;
-    while(s[beg]==' '){
-      beg++;
-    }
-    int end=s.size()-1;
-    while(s[end]==' '){
-      end--;
-    }
-    std::string newstring;
-    for(int j=beg;j<=end;j++) newstring += s[j];
-    return newstring;
-  }
-  //------------------------------------------------------------------------
-
-  std::string charToBinary(char c)
-  {
-    /**
-     * A single byte, represented by a char type, is read in and converted
-     * to a binary representation.
-     *
-     * Used for debugging the single-bit writing and reading tasks.
-     *
-     * \param c A single byte, of char type.
-     * \return A std:string that shows the binary representation of that byte.
-     */
-
-    std::stringstream ss;
-    int num=c;
-    if (num<0) num+=256;
-    int factor = 128;
-    for(int i=0;i<8;i++){
-      ss << num/factor;
-      num -= num/factor * factor;
-      factor /= 2;
-    }
-    return ss.str();
-  }
-  //------------------------------------------------------------------------
-
-  std::string binaryToString(std::vector<bool> v)
-  {
-    /**
-     * A string of bits, read in as a vector of bool types, is coverted to the
-     *  equivalent string of bytes, in the form of chars (in fact, a std::string).
-     *
-     * Used for debugging the single-bit writing and reading tasks.
-     *
-     * \param v String of bits.
-     * \return Std::string of bytes (each byte a char).
-     */
-    int size = v.size();
-    int nbytes = (size-1)/8 + 1;
-    std::string output;
-    for(int byte=0;byte<nbytes;byte++){
-      int c=0;
-      for(int bit=0;bit<8;bit++){
-	int pt = byte*8+bit;
-	if(v[pt]) c += int(pow(2,7-bit));
-      }
-      //    std::cerr << int(c) << std::endl;
-      output += char(c);
-    }
-    return output;
-  }
-  //------------------------------------------------------------------------
-
-  unsigned int * binaryToInt(std::vector<bool> v)
-  {
-    /**
-     * A string of bits, read in as a vector of bool types, is coverted to a 
-     *  series of bytes, which are expressed as an array of integers (with the
-     *  decimal value of each byte).
-     *
-     * Used for debugging the single-bit writing and reading tasks.
-     *
-     * \param v String of bits.
-     * \return Sequence of integers, being the decimal value of each byte.
-     */
-    int size = v.size();
-    int nbytes = (size-1)/8 + 1;
-    unsigned int *output = new unsigned int[nbytes];
-    for(int byte=0;byte<nbytes;byte++){
-      int c=0;
-      for(int bit=0;bit<8;bit++){
-	int pt = byte*8+bit;
-	if(v[pt]) c += (unsigned int)pow(2,7-bit);
-      }
-      //    std::cerr << c << std::endl;
-      output[byte] = c;
-    }
-    return output;
-  }
-  //------------------------------------------------------------------------
-
-  double dmsToDec(std::string input)
-  {
-    /** 
-     *   Assumes the angle given is in degrees, so if passing RA as
-     *   the argument, need to multiply by 15 to get the result in
-     *   degrees rather than hours.  The sign of the angle is
-     *   preserved, if present.
-     */
-
-    std::string dms = removeLeadingBlanks(input);
-
-    bool isNeg = false;
-    if(dms[0]=='-') isNeg = true;
-
-    for(unsigned int i=0;i<dms.size();i++) if(dms[i]==':') dms[i]=' ';
-
-    std::stringstream ss;
-    ss.str(dms);
-
-    double d,m,s;
-    ss >> d >> m >> s;
-
-    double dec = fabs(d) + m/60. + s/3600.;
-    if(isNeg) dec = dec * -1.;
-
-    return dec;
-
-  }
-  //------------------------------------------------------------------------
-
-  std::string decToDMS(double input, int secondPrecision, std::string separator)
-  {
-    /**
-     *   This is the general form, where one can specify the degree of
-     *   precision of the seconds, and the separating character.
-     *  \param input Angle in decimal degrees.
-     *  \param secondPrecision How many decimal places to quote the seconds to.
-     *  \param separator The character (or string) to use as a
-     *  separator between hh and mm, and mm and ss.sss.
-     */ 
-    double hour = trunc(input);
-    double fraction = fabs(input - hour);
-    double min = trunc( fraction * 60. );
-    fraction = fraction * 60. - min;
-    double sec = fraction * 60.;
-  
-    int secondWidth = 2;
-    if(secondPrecision>0) secondWidth += 1 + secondPrecision;
-
-    std::stringstream output;
-    output.setf(std::ios::fixed);
-    output << std::setw(2) << std::setfill('0') << std::setprecision(0)
-	   << hour << separator 
-	   << std::setw(2) << std::setfill('0') << std::setprecision(0)
-	   << min  << separator ;
-    output << std::setw(secondWidth) << std::setfill('0') 
-	   << std::setprecision(secondPrecision) << sec;
-
-    return output.str();
-  }
-  //------------------------------------------------------------------------
-
-  std::string getIAUName(double ra, double dec)
-  {
-    /**
-     *  The positions are assumed to be J2000.0, since the name is
-     *  prefixed by a J.
-     *
-     *  \param ra RA position, in degrees.
-     *  \param dec Dec position, in degrees.
-     *  \return Name of the form J1234m4321 or J1234p0123
-     */
-
-    double raHrs = ra / 15.;
-    int h = int(raHrs);
-    int m = (int)(fmod(raHrs,1.)*60.);
-    int s = (int)(fmod(raHrs,1./60.)*3600.);
-    std::stringstream ss(std::stringstream::out);
-    ss.setf(std::ios::showpoint);
-    ss.setf(std::ios::fixed);
-    ss << "J"; 
-    ss<<std::setw(2)<<std::setfill('0')<<h;
-    ss<<std::setw(2)<<std::setfill('0')<<m;
-    ss<<std::setw(2)<<std::setfill('0')<<s;
-    int sign = int( dec / fabs(dec) );
-    double d = dec / sign;
-    h = int(d);
-    m = (int)(fmod(d,1.)*60.);
-    s = (int)(fmod(d,1./60.)*3600.);
-    if(sign==1) ss<<"p"; else ss<<"m";
-    ss<<std::setw(2)<<std::setfill('0')<<h;
-    ss.unsetf(std::ios::showpos);
-    ss<<std::setw(2)<<std::setfill('0')<<m;
-    ss<<std::setw(2)<<std::setfill('0')<<s;
-    return ss.str();
-  }
-  //------------------------------------------------------------------------
-
-  time_t my_timegm (struct tm *tm) {
-    /**
-     * Local function to get the proper GM time.
-     */
-    time_t ret;
-    char *tz;
-
-    tz = getenv("TZ");
-    setenv("TZ", "", 1);
-    tzset();
-    ret = mktime(tm);
-    if (tz) setenv("TZ", tz, 1);
-    else    unsetenv("TZ");
-    tzset();
-    return ret;
-  }
-
-  std::string addDay(std::string date)
-  {
-    /**
-     *   This assumes the format is yy/mm/dd or yymmdd or yy-mm-dd
-     *    -- the crucial thing is that the day number is in the last spot.
-     *   The format of the date is preserved, as long as it is one of those 3.
-     *  \param date Input date.
-     *  \return Date of same format as input, but one day later.
-     */ 
-
-    struct tm time;
-    time.tm_hour=0;
-    time.tm_min =0;
-    time.tm_sec =1;
-    char buf[255];
-    std::string output;
-    time_t temp;
-    if(date.size()==6) {
-      strptime(date.c_str(), "%y%m%d", &time);
-      time.tm_mday += 1;
-      temp = my_timegm(&time);
-      strftime(buf, sizeof(buf), "%y%m%d", gmtime(&temp));
-    }
-    else if(date[2]=='/'){
-      strptime(date.c_str(), "%y/%m/%d", &time);
-      time.tm_mday += 1;
-      temp = my_timegm(&time);
-      strftime(buf, sizeof(buf), "%y/%m/%d", gmtime(&temp));
-    }
-    else if(date[2]=='-'){
-      strptime(date.c_str(), "%y-%m-%d", &time);
-      time.tm_mday += 1;
-      temp = my_timegm(&time);
-      strftime(buf, sizeof(buf), "%y-%m-%d", gmtime(&temp));
-    }
-    else{
-      std::cerr << "<addDay> : date (" << date << ") has unknown format!\n";
-      return date;
-    }
-    output = buf;
-    return output;
-  
-  }
-  //------------------------------------------------------------------------
-
-  std::string makeDateObs(std::string date, std::string time)
-  {
-
-    /**
-     * This produces a string of the form YY-MM-DDThh:mm:ss.sss, using
-     * strings containing the date and the time. It is simply a matter
-     * of concatenating them, but we check the date string to make sure
-     * it has the hyphens in it.
-     *
-     * \param date A date string, assumed to be of the format YY-MM-DD,
-     * YY/MM/DD, or YYMMDD.
-     * \param time A time string, assumed to be in the format
-     * hh:mm:ss[.sss] (the fractional seconds are optional).
-     * \return A properly formatted date/time string.
-     */
-
-    std::string date_obs;
-    bool hashyphens = false;
-    for(unsigned int i=0;i<date.size();i++) 
-      hashyphens = hashyphens || (date[i]=='-') || (date[i] == '/');
-    if(hashyphens) date_obs = date;
-    else date_obs = date.substr(0,2) + "-" + 
-	   date.substr(2,2) + "-" + date.substr(4,2);
-    if(date[0]=='0') date_obs = "20" + date_obs;
-    else             date_obs = "19" + date_obs;
-    for(unsigned int i=0;i<date_obs.size();i++) 
-      if(date_obs[i]=='/') date_obs[i]='-';
-
-    date_obs += "T" + time;
-
-    return date_obs;
-
-  }
-  //------------------------------------------------------------------------
-
-  double angSep(std::string ra1, std::string dec1, 
-		std::string ra2, std::string dec2)
-  {
-    /**
-     *  Calculates the angular separation between two sky positions,
-     *  given as strings for RA and DEC. Uses the function
-     *  angSep(double,double,double,double).
-     * \param ra1 The right ascension for the first position.
-     * \param dec1 The declination for the first position.
-     * \param ra2 The right ascension for the second position.
-     * \param dec2 The declination for the second position.
-     * \return The angular separation in degrees.
-     */
-    if((ra1==ra2)&&(dec1==dec2)) 
-      return 0.;
-    else
-      return angSep(dmsToDec(ra1)*15.,dmsToDec(dec1),
-		    dmsToDec(ra2)*15.,dmsToDec(dec2) );
-  }
-
-  double angSep(double ra1, double dec1, double ra2, double dec2)
-  {
-    /**
-     *  Calculates the angular separation between two sky positions,
-     *  where RA and DEC are given in decimal degrees.
-     * \param ra1 The right ascension for the first position.
-     * \param dec1 The declination for the first position.
-     * \param ra2 The right ascension for the second position.
-     * \param dec2 The declination for the second position.
-     * \return The angular separation in degrees.
-     */
-    double r1,d1,r2,d2;
-    r1 = ra1  * M_PI / 180.;
-    d1 = dec1 * M_PI / 180.;
-    r2 = ra2  * M_PI / 180.;
-    d2 = dec2 * M_PI / 180.;
-    long double angsep = cos(r1-r2)*cos(d1)*cos(d2) + sin(d1)*sin(d2);
-    
-    return acosl(angsep)*180./M_PI;
-    
-  }
-  //------------------------------------------------------------------------
-
-  void equatToGal(double ra, double dec, double &gl, double &gb)
-  {
-    /**
-     * Converts an equatorial (ra,dec) position to galactic
-     * coordinates. The equatorial position is assumed to be J2000.0.
-     *
-     * \param ra Right Ascension, J2000.0
-     * \param dec Declination, J2000.0
-     * \param gl Galactic Longitude. Returned value.
-     * \param gb Galactic Latitude. Returned value.
-     */
-
-    const double NGP_RA = 192.859508 * M_PI/180.;
-    const double NGP_DEC= 27.128336 * M_PI/180.;
-    const double ASC_NODE=32.932;
-
-    double deltaRA = ra * M_PI/180. - NGP_RA;
-    double d = dec     * M_PI/180.;
-    double sinb = cos(d) * cos(NGP_DEC) * cos(deltaRA) + sin(d) * sin(NGP_DEC);
-    gb = asin(sinb);
-
-    // The l in sinl and cosl here is really gl-ASC_NODE
-    double sinl = (sin(d)*cos(NGP_DEC) - cos(d)*cos(deltaRA)*sin(NGP_DEC)) / cos(gb);
-    double cosl = cos(d) * sin(deltaRA) / cos(gb);
-    // atan returns a value between -90 and 90 degrees.
-    // Need to correct the value of l according to the correct quandrant it is in.
-    // This is worked out using the signs of sinl and cosl
-    if(sinl>0){
-      if(cosl>0) gl = atan(sinl/cosl);
-      else       gl = atan(sinl/cosl) + M_PI;
-    }
-    else{
-      if(cosl>0) gl = atan(sinl/cosl) + 2.*M_PI;
-      else       gl = atan(sinl/cosl) + M_PI;
-    }
-
-    // Find the correct values of the lat & lon in degrees.
-    gb = asin(sinb) * 180. / M_PI;
-    gl = gl * 180. / M_PI + ASC_NODE;
-  }
-  //------------------------------------------------------------------------
-
-  unsigned char reverseByte(unsigned char c)
-  {
-    /**
-     *  Reverses the bits in a char (a byte), by using a 256-element
-     *  look-up table. This means 01100011 becomes 11000110.
-     *  /param c The byte, as a char, to be reversed.
-     *  /return The reversed byte.
-     */
-
-    static const unsigned char BitReverseTable256[] = 
-      {
-	0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0, 
-	0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, 0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8, 
-	0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4, 0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4, 
-	0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC, 0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC, 
-	0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2, 0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2, 
-	0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA, 0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA,
-	0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6, 0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6, 
-	0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE, 0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE,
-	0x01, 0x81, 0x41, 0xC1, 0x21, 0xA1, 0x61, 0xE1, 0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1,
-	0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9, 0x19, 0x99, 0x59, 0xD9, 0x39, 0xB9, 0x79, 0xF9, 
-	0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5, 0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5,
-	0x0D, 0x8D, 0x4D, 0xCD, 0x2D, 0xAD, 0x6D, 0xED, 0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD,
-	0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3, 0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3, 
-	0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB, 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB,
-	0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7, 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7, 
-	0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF
-      };
-    
-    unsigned char t = c;
-    unsigned char r = BitReverseTable256[c & 0xff];
-    return r;
-
-  }
-
-  unsigned char bitToggle(unsigned char c)
-  {
-    /**
-     *  Toggles each bit in a byte, changing 0s to 1s and 1s to 0s.
-     *  We use a lookup table for transparency -- could easily just
-     *  use the complement bit function ~, but this is just as good.
-     * \param c Byte to toggle
-     * \return Byte with bits toggled (ooh matron!)
-     */
-    const unsigned char BitToggleTable256[] = 
-      {
-	0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf2, 0xf1, 0xf0, 
-	0xef, 0xee, 0xed, 0xec, 0xeb, 0xea, 0xe9, 0xe8, 0xe7, 0xe6, 0xe5, 0xe4, 0xe3, 0xe2, 0xe1, 0xe0, 
-	0xdf, 0xde, 0xdd, 0xdc, 0xdb, 0xda, 0xd9, 0xd8, 0xd7, 0xd6, 0xd5, 0xd4, 0xd3, 0xd2, 0xd1, 0xd0, 
-	0xcf, 0xce, 0xcd, 0xcc, 0xcb, 0xca, 0xc9, 0xc8, 0xc7, 0xc6, 0xc5, 0xc4, 0xc3, 0xc2, 0xc1, 0xc0, 
-	0xbf, 0xbe, 0xbd, 0xbc, 0xbb, 0xba, 0xb9, 0xb8, 0xb7, 0xb6, 0xb5, 0xb4, 0xb3, 0xb2, 0xb1, 0xb0, 
-	0xaf, 0xae, 0xad, 0xac, 0xab, 0xaa, 0xa9, 0xa8, 0xa7, 0xa6, 0xa5, 0xa4, 0xa3, 0xa2, 0xa1, 0xa0, 
-	0x9f, 0x9e, 0x9d, 0x9c, 0x9b, 0x9a, 0x99, 0x98, 0x97, 0x96, 0x95, 0x94, 0x93, 0x92, 0x91, 0x90, 
-	0x8f, 0x8e, 0x8d, 0x8c, 0x8b, 0x8a, 0x89, 0x88, 0x87, 0x86, 0x85, 0x84, 0x83, 0x82, 0x81, 0x80, 
-	0x7f, 0x7e, 0x7d, 0x7c, 0x7b, 0x7a, 0x79, 0x78, 0x77, 0x76, 0x75, 0x74, 0x73, 0x72, 0x71, 0x70, 
-	0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x69, 0x68, 0x67, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x60, 
-	0x5f, 0x5e, 0x5d, 0x5c, 0x5b, 0x5a, 0x59, 0x58, 0x57, 0x56, 0x55, 0x54, 0x53, 0x52, 0x51, 0x50, 
-	0x4f, 0x4e, 0x4d, 0x4c, 0x4b, 0x4a, 0x49, 0x48, 0x47, 0x46, 0x45, 0x44, 0x43, 0x42, 0x41, 0x40, 
-	0x3f, 0x3e, 0x3d, 0x3c, 0x3b, 0x3a, 0x39, 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 
-	0x2f, 0x2e, 0x2d, 0x2c, 0x2b, 0x2a, 0x29, 0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, 0x20, 
-	0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 
-	0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00
-      };
-
-    unsigned char d = BitToggleTable256[c];
-    
-//    unsigned char d = ~c;
-
-    return d;
-
-  }
-
-}
Index: unk/src/pvo-utils.hh
===================================================================
--- /trunk/src/pvo-utils.hh	(revision 486)
+++ 	(revision )
@@ -1,74 +1,0 @@
-#ifndef UTILS_HH_
-#define UTILS_HH_
-#include <iostream>
-#include <string>
-#include <vector>
-
-namespace PVO
-{
-
-  /** Report a general error, along with the offending function. */
-  void PVOError(std::string subroutine, std::string error);
-  
-  /** Return a vector list of all FITS files in the current directory. */
-  std::vector<std::string> getAllFitsFiles();
-
-  /** Return the filename of the defintion file of the PSRFITS format. */
-  std::string getPSRFITSdefn();
-
-  std::string removeLeadingBlanks(std::string s);
-  ///< Remove blank spaces from start of a string.
-
-  std::string deblank(std::string s);
-  ///< Remove blank spaces from start and end of a string.  
-   
-  std::string charToBinary(char c);
-  ///< Convert a byte to binary representation.
-
-  std::string binaryToString(std::vector<bool> v);
-  ///< Convert a bit-wise binary representation to a set of bytes. 
-
-  unsigned int * binaryToInt(std::vector<bool> v);
-  ///<Convert a series of bits into a series of bytes in decimal format.
-
-  double dmsToDec(std::string input);   
-  ///< Converts a string in the format +12:23:34.45 to a decimal angle
-  ///in degrees.
-
-  std::string decToDMS(double input, int secondPrecision, 
-		       std::string separator);
-  ///< Converts a decimal into a dd:mm:ss.ss format.
-
-  /** Particular instance of decToDMS(double,int,std::string) with
-      standard precision & separator */
-  inline std::string decToDMS(double input){ return decToDMS(input,2,":"); };
-
-  /** Find the angular separation of two sky positions.*/
-  double angSep(std::string ra1, std::string dec1, 
-		std::string ra2, std::string dec2);
-
-  /** Find the angular separation of two sky positions.*/
-  double angSep(double ra1, double dec1, double ra2, double dec2);
-
-  /** Convert equatorial coordinates to Galactic. */
-  void equatToGal(double ra, double dec, double &gl, double &gb);
-
-  std::string getIAUName(double ra, double dec);  
-  ///< Create an IAU-style formatted name, based on the equatorial position.
-
-  std::string addDay(std::string date);
-  ///< A function to add a day onto the date.
-
-  /** Makes the DATE-OBS header keyword in the format mandated by the
-      FITS standard. */
-  std::string makeDateObs(std::string date, std::string time);
-
-  /** Reverse the bits in a byte */
-  unsigned char reverseByte(unsigned char c);
-
-  /** Toggle the bits in a byte (0->1 and 1->0) */
-  unsigned char bitToggle(unsigned char c);
-
-}
-
-#endif /*UTILS_HH_*/
Index: unk/src/pvo.hh
===================================================================
--- /trunk/src/pvo.hh	(revision 486)
+++ 	(revision )
@@ -1,180 +1,0 @@
-#ifndef PVO_HH_
-#define PVO_HH_
-#include <iostream>
-
-namespace PVO
-{
-
-  /** Version number of PVO programs */
-  const std::string PVO_VERSION = "1.0";
-  
-  const std::string PVOCONVERT = "pvoconvert";
-  const std::string PVOSUMMARY = "pvosummary";
-  const std::string PVOCONESEARCH = "pvoconesearch";
-  const std::string PVOTAPESUMMARY = "pvotapesummary";
-
-  /** Standard NULL value for strings. */
-  const std::string nullString = "NULL";
-
-  /** Standard NULL value for floats. */
-  const float       nullFloat = -9999.;
-
-  /** Standard NULL value for ints. */
-  const int         nullInt = -9999;
-
-  /** Help text for pvoconvert -h */
-  const std::string pvoconvert_usage_text = 
-"Usage: pvoconvert [options] <survey file(s)> ...\n\
-  Running options:\n\
-  -c                Clobber: overwrite files if they exist\n\
-  --clobber           (default is to exit if a file exists)\n\
-  -D <dir>          Run pvoconvert on all files in the stated directory.\n\
-  --directory <dir>\n\
-                     No <survey file> needs to be given in this case.\n\
-  -H                Use the PH (High Latitude) Survey settings, rather than\n\
-  --highlat          those for the PM/Multibeam Survey\n\
-  -t                Run through the input files as normal, but do not write\n\
-  --test             any new files, just list the filenames that would be\n\
-                     created and note whether they exist or not.\n\
-  -V                Verbose mode for error/warning messages.\n\
-  --verbose\n\
-\n\
-  Other options:\n\
-  -h                Display this help page.\n\
-  --help\n\
-  -v                Display the version number.\n\
-  --version\n\
----------\n\n\
- PVOConvert converts pulsar survey data into PSRFITS format.\n\
- It can distinguish between the 70cm data and 21cm Multibeam data, but to\n\
-  specify particular data as coming from the High Latitude survey rather\n\
-  than the standard Multibeam survey, use the -h option.\n\
- Note that more than one input file can be given.\n\
- Output files will be encoded according to the survey type and date & time\n\
-  of observation.\n\
- The -t option provides the ability to see what files pvoconvert would\n\
-  produce, without actually producing them. It also tells you if a file \n\
-  already exists (which would cause a problem).\n";
-  /** Brief help text for pvoconvert -h */
-  const std::string pvoconvert_usage_text_short = 
-"Usage: pvoconvert [options] <survey file(s)> ...\n\
-  Running options:\n\
-  -c                Clobber: overwrite files if they exist\n\
-  --clobber           (default is to exit if a file exists)\n\
-  -D <dir>          Run pvoconvert on all files in the stated directory.\n\
-  --directory <dir>\n\
-                     No <survey file> needs to be given in this case.\n\
-  -H                Use the PH (High Latitude) Survey settings, rather than\n\
-  --highlat          those for the PM/Multibeam Survey\n\
-  -t                Run through the input files as normal, but do not write\n\
-  --test             any new files, just list the filenames that would be\n\
-                     created and note whether they exist or not.\n\
-  -V                Verbose mode for error/warning messages.\n\
-  --verbose\n\
-\n\
-  Other options:\n\
-  -h                Display the help page.\n\
-  --help\n\
-  -v                Display the version number.\n\
-  --version\n";
-
-  /** Help text for pvosummary -h */
-  const std::string pvosummary_usage_text = 
-"Usage:\n\
-  1. pvosummary [options]\n\
-  2. pvosummary [options] <FILE>\n\
----------\n\
- pvosummary  prints out some basic metadata for either all FITS files in the\n\
-  current directory (example 1), or a single FITS file (example 2).\n\
- The parameters printed out are:\n\
-   FILENAME, SRC_NAME, RAJ, DECJ, BEAM FWHM, OBSFREQ, SCANLEN, DATE-OBS\n\
- If a keyword is not present, "+nullString+" is printed.\n\
- The full set of parameters can be written in csv format to a file using the\n\
-   -c or --csv option.\n\
- The list of parameters can be obtained by using the -p option.\n\
- FITS files are assumed to have suffixes of .fits or .rf\n\n\
- Running options:\n\
- -c <file>    Write all parameters in csv format to the specified file.\n\
- --csv <file>\n\
- -p           List all parameters\n\
- -q           Quiet mode -- nothing printed to screen\n\
-               (used in conjunction with -c)\n\
- -V           Verbose mode for error/warning messages.\n\
- --verbose\n\
-  Other options:\n\
- -h           Print this help message.\n\
- --help \n\
- -v           Print the version number.\n\
- --version \n\
----------\n\
-";
-  /** Brief help text for pvosummary -h */
-  const std::string pvosummary_usage_text_short = 
-"Usage:\n\
-  1. pvosummary [options]\n\
-  2. pvosummary [options] <FILE>\n\
- Running options:\n\
- -c <file>    Write all parameters in csv format to the specified file.\n\
- --csv <file>\n\
- -p           List all parameters\n\
- -q           Quiet mode -- nothing printed to screen\n\
-               (used in conjunction with -c)\n\
- -v           Verbose mode for error/warning messages.\n\
- --verbose\n\
- Other options:\n\
- -h           Print a help message.\n\
- --help\n\
- -v           Print the version number.\n\
- --version \n";
-
-  /** Help text for pvotapesummary -h */
-  const std::string pvotapesummary_usage_text = 
-"Usage:\n\
-  1. pvotapesummary [FILE] ...\n\
-  2. pvotapesummary -d <DIR>\n\
----------\n\
- pvotapesummary  prints out some basic metadata for either all tape survey files\n\
-  provided as arguments (#1), or all files in the specified directory (#2).\n\
- You can optionally specify individual files: the alternative is to examine each\n\
-  file in the directory.\n\
- The metadata is taken just from the first block in the tape file.\n\
- The parameters printed out are:\n\
-   FILENAME, RA, DEC, OBSFREQ, CHANBW, SCANLEN, MOVE, DATE-OBS\n\
----------\n\
-";
-
-  /** Help text for pvoconesearch -h */
-  const std::string pvoconesearch_usage_text = 
-"Usage:\n\
-  1. pvoconesearch ra dec radius\n\
-  2. pvoconesearch -h\n\
----------\n\
-  1. Prints RA, DEC, BEAM FWHM, OBSFREQ, DATE-OBS, OFFSET for all FITS files\n\
-     that lie within \"radius\" of the position given by ra, dec.\n\
-     OFFSET is angular offset from query position.\n\
-  2. Prints this help information.\n\n\
- The valid files are listed in order of increasing angular separation from\n\
-  the query position.\n\
- The RA and DEC can be in the form hh:mm:ss.ss etc or in decimal degrees.\n\
- The search radius is in degrees. The beam size is also taken into account,\n\
-  so the effective search radius becomes (radius + 0.5*beamFWHM).\n\
- Note that if a keyword is not present, NULL is printed.\n\
- FITS files are assumed to have suffixes of .fits or .rf\n";
-  /** Brief help text for pvoconesearch -h */
-  const std::string pvoconesearch_usage_text_short = 
-"Usage:\n\
-  1. pvoconesearch ra dec radius\n\
-  2. pvoconesearch -h\n";
-
-  const std::string pvofixfilename_usage_text = 
-"Usage:\n\
-  pvofixfilename\n\
---------\n\
-  Looks for all .fits, .sf, .rf files in the current directory and determines\n\
-   whether they have been wrongly labelled .sf or .fits instead of .rf, and \n\
-   re-names them (after asking approval).\n";
-
-
-}
-
-#endif // PVO_HH_
Index: unk/src/pvoconesearch.cc
===================================================================
--- /trunk/src/pvoconesearch.cc	(revision 486)
+++ 	(revision )
@@ -1,139 +1,0 @@
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <iomanip>
-#include <string>
-#include "pvo.hh"
-#include "pvo-block.hh"
-#include "pvo-header.hh"
-#include "pvo-FITS.hh"
-#include "pvo-utils.hh"
-#include "pvo-metadata.hh"
-
-using namespace PVO;
-using namespace PVO::Header;
-using namespace PVO::Block;
-using namespace PVO::FITS;
-using namespace PVO::Meta;
-using std::string;
-
-
-
-int main(int argc, char * argv[])
-{
-  /** 
-   * PVOConeSearch is a function to do basic cone searching in PSRFITS files.
-   *
-   * This program is a command-line program that looks at all PSRFITS
-   * files in the current directory (i.e. files that have extensions
-   * .fits, .rf or .sf) and returns all those that cover sky within a
-   * given search radius of a given RA,DEC position.
-   *
-   * The format of usage is: <br> 
-   * <tt>> pvoconesearch RA DEC RADIUS</tt><br> 
-   * RA and DEC can be in either decimal degrees or hms/dms
-   * format (i.e.  hh:mm:ss.sss for RA and dd:mm:ss.sss for
-   * DEC). Entering <br>
-   * <tt>> pvoconesearch -h</tt><br>
-   * will give a help message, using PVO::pvoconesearch_usage_text.
-   *
-   * The output is a list of valid files, their central RA & DEC,
-   * their beam size, the central observing frequency, the DATE-OBS
-   * keyword (time/date of observation), plus the angular offset [deg]
-   * from the query position. The beam size of the FITS file is taken
-   * into account, so that the central position can be more than
-   * RADIUS away from the query position (as long as the query
-   * position is still within the primary beam's FWHM).
-   * 
-   */
-
-
-  bool verboseflag = false;
-
-  std::vector<std::string> namelist;
-  std::string RAstring,DECstring;
-  double radius,RAcentre,DECcentre;
-  unsigned int i,numColon;
-  switch(argc){
-  case 4:
-    namelist = PVO::getAllFitsFiles();
-
-    RAstring = argv[1];
-    numColon=0;
-    for(i=0;i<RAstring.size();i++) if(RAstring[i]==':') numColon++;
-    if(numColon>0) RAcentre = dmsToDec(RAstring)*15.;
-    else RAcentre = atof(argv[1]);
-    DECstring = argv[2];
-    numColon=0;
-    for(i=0;i<DECstring.size();i++) if(DECstring[i]==':') numColon++;
-    if(numColon>0) DECcentre = dmsToDec(DECstring);
-    else DECcentre = atof(argv[2]);
-
-    radius = atof(argv[3]);
-    
-    std::cout.setf(std::ios::fixed);
-    std::cout << std::setprecision(4)
-	      << "Searching with: RA = " << RAcentre
-	      << " deg, DEC = " << DECcentre
-	      << " deg, Radius = " << radius << " deg\n";
-
-    break;
-  default:
-    if(argc==2 && strcmp(argv[1],"-h")==0)
-      std::cout << pvoconesearch_usage_text;
-    else
-      std::cerr << pvoconesearch_usage_text_short;
-    return 0;
-    break;
-  }
-
-  ///////////////////////////////////////////
-  // Now actually do the work...
-
-  std::vector<Metadata> goodlist;
-
-  std::cout << "Progress: |";
-  for(int n=0;n<20;n++) std::cout << " ";
-  std::cout << "|";
-  for(int n=0;n<32;n++) std::cout << '\b';
-  std::cout << std::flush;
-  int nhash=0;
-  float stepsize=namelist.size()/20.;
-
-  for(i=0;i<namelist.size();i++){
-
-    if(i/stepsize > nhash){
-      nhash++;
-      std::cout << "Progress: |";
-      int n=0;
-      for(;n<nhash;n++) std::cout << "#";
-      for(;n<20;n++) std::cout << " ";
-      std::cout << "|";
-      for(n=0;n<32;n++) std::cout << '\b';
-      std::cout << std::flush;
-    }
-
-    PSRFits fitsfile;
-    fitsfile.setVerbosity(verboseflag);
-    int status = fitsfile.openFile(namelist[i],READONLY);
-
-    if(status==0){
-      Metadata newmatch;
-      newmatch.setSep(true);
-      newmatch.define(fitsfile);
-      if(newmatch.close(RAcentre,DECcentre,radius)) 
-	goodlist.push_back(newmatch);
-    }
-
-    fitsfile.closeFile();
-
-
-  }
-
-
-  std::stable_sort(goodlist.begin(),goodlist.end());
-
-  printMetadataShort(std::cout,goodlist);
-
-}
-
Index: unk/src/pvoconvert.cc
===================================================================
--- /trunk/src/pvoconvert.cc	(revision 486)
+++ 	(revision )
@@ -1,273 +1,0 @@
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <iomanip>
-#include <string>
-#include <unistd.h>
-#include <getopt.h>
-#include <glob.h>
-#include "pvo.hh"
-#include "pvo-block.hh"
-#include "pvo-header.hh"
-#include "pvo-FITS.hh"
-#include "pvo-utils.hh"
-
-using namespace PVO;
-using namespace PVO::Header;
-using namespace PVO::Block;
-using namespace PVO::FITS;
-using std::string;
-
-int main(int argc, char * argv[])
-{
-  /** 
-   * PVOConvert is a function that converts pulsar survey data into a
-   * standard PSRFITS format.
-   *
-   * This program is a command-line program that accepts an existing
-   * file as an argument. It works out what survey the data is from
-   * (based initially on the first few bytes of the file, and also
-   * using the input flags -- see below), and uses this information to
-   * interpret the header blocks.
-   *
-   * The binary data is written to the SUBINT binary table extension,
-   * and a record of the command-line statement is written to the
-   * HISTORY table. No other tables are written.
-   *
-   * The format of usage is: <br> 
-   * <tt>> pvoconvert FILE </tt><br>
-   * Wildcards or multiple files are accepted. To run on all files in a
-   * directory, use the <tt>-D</tt> option:<br>
-   * <tt>> pvoconvert -D DIR </tt><br>
-   * If the input FILE is from the Parkes High Latitude Multibeam
-   * Survey (PH, Burgay et al. 2006), one needs to use the <tt>-H</tt>
-   * flag to use the PH settings (for integration time etc), rather
-   * than those of the Multibeam survey (PM, Manchester et
-   * al. 2001):<br>
-   * <tt>> pvoconvert -H FILE </tt><br>
-   * Using the <tt>-v</tt> option means all error messages will be
-   * displayed. Entering<br>
-   * <tt>> pvosummary -h</tt><br>
-   * will give a help message, using PVO::pvoconvert_usage_text.
-   *
-   */
-
-  std::vector<std::string> namelist;
-  bool verbFlag = false;
-  bool usingHighLatitude = false;
-  bool writingData = true;
-  bool clobberFlag = false;
-  unsigned int i;
-
-  if(argc==1){
-    std::cout << PVO::pvoconvert_usage_text_short;
-    return 1;
-  }
-
-  char c;
-  while (true) {
-    int option_index = 0;
-    static struct option long_options[] = {
-      {"clobber", 0, 0, 'c'},
-      {"help", 0, 0, 'h'},
-      {"highlat", 0, 0, 'H'},
-      {"directory", 1, 0, 'D'},
-      {"test", 0, 0, 't'},
-      {"verbose", 0, 0, 'V'},
-      {"version", 0, 0, 'v'},
-      {0, 0, 0, 0}
-    };
-
-    c = getopt_long (argc, argv, "D:HVvhtc",
-		     long_options, &option_index);
-
-    if (c == -1) break;
-
-    std::string directory,filenames;
-    glob_t globbuf1,globbuf2;
-
-    switch (c) {               
-    case 0:
-      // This is where we deal with -- options that don't have a
-      // single letter equivalent
-      break;
-    case 'D': // use all files in the specified directory.
-      directory = optarg;
-      globbuf1.gl_offs = 0;
-      globbuf2.gl_offs = 0;
-      filenames = directory + "/*";
-      glob(filenames.c_str(), GLOB_DOOFFS, NULL, &globbuf1);
-      namelist.resize(globbuf1.gl_pathc);
-      for(i=0;i<globbuf1.gl_pathc+globbuf1.gl_offs;i++) {
-	namelist[i] = globbuf1.gl_pathv[i];
-      }
-      break;
-    case 'v': // return version number
-      std::cout << PVO::PVOCONVERT << " version " << PVO::PVO_VERSION << "\n";
-      return 0;
-      break;
-    case 'V': // use verbose mode
-      verbFlag = true;
-      if(argc==2){
-	std::cout << PVO::pvoconvert_usage_text_short;
-	return 1;
-      }
-      break;
-    case 't': // test mode -- don't write any data, just report the filenames.
-      writingData = false;
-      break;
-    case 'h': // give help statement
-      std::cout << PVO::pvoconvert_usage_text;
-      return 0;
-      break;
-    case 'c': // clobber files
-      clobberFlag = true;
-      break;
-    case 'H': // High Latitude survey
-      usingHighLatitude = true;
-      break;
-    case '?': // invalid option
-    case ':': // missing an argument
-      std::cout <<  PVO::pvoconvert_usage_text_short;
-      return 1;
-      break;
-    default:
-      std::cerr << "ERROR: getopt returned character code " <<  c << "\n";
-      break;
-    }
-  }
-
-  if (optind < argc) { 
-    // There is a non-option argument -- must be the file to access
-    while (optind < argc) namelist.push_back( argv[optind++] );
-  }
-
-  if(!writingData){
-    std::cout << "List of files that will be produced if -t is not used: \n";
-    if(namelist.size()>1)
-      std::cout << "  (grouped according to input file)\n";
-  }
-
-  for(i=0; i<namelist.size(); i++){
-
-    std::string fname = namelist[i];
-    bool doThisOne = true;
-
-    SURVEY currentSurvey = idSurvey(fname);
-    if(currentSurvey == NONEXISTENT) {
-      std::cout << "ERROR: File " << fname <<" does not exist. Skipping this.\n";
-      doThisOne = false;
-    }
-
-    if(usingHighLatitude){
-      if(currentSurvey == PM) currentSurvey = PH;
-      else if(currentSurvey!=DUD){
-	std::cout << "WARNING: " << fname << " is a " << surveyNames[currentSurvey] <<" file.\n"
-		  << " High Latitude survey settings are NOT being used.\n";
-// 	doThisOne = false;
-      }
-    }
-
-    std::string file_loc = "";
-    int cwdSize=200;
-    char *cwd = new char[200];
-    if(fname[0]!='/'){
-//       file_loc = get_current_dir_name();
-      getcwd(cwd,cwdSize);
-      file_loc=cwd;
-      file_loc += "/";
-    }
-    file_loc += fname;
-    if(doThisOne) {
-      std::cout << "Input file " << file_loc <<" : ";
-      if(currentSurvey == DUD){
-	std::cout << "  Skipping this file.\n";
-	doThisOne = false;
-      }
-      else {
-	std::cout << surveyNames[currentSurvey]<<"\n";
-      }
-    }
-
-    if(doThisOne){
-
-      std::ifstream fin;
-      fin.open(fname.c_str(), std::ios::binary);
-
-      bool eof;
-      DataBlock block(currentSurvey);
-      block.readBlock(fin);
-  
-      int newBeam = block.getKeyword<int>(IBEAM);
-      int oldBeam;
-      bool newMoveFlag= block.telescopeOK();
-      bool oldMoveFlag;
-
-      PSRFits fitsfile;
-      fitsfile.setWritingData(writingData);
-      fitsfile.setVerbosity(verbFlag);
-      fitsfile.setClobber(clobberFlag);
-      //      fitsfile.setOldFilename(fname);
-      fitsfile.setCommandLine(argv[0],fname);
-
-      if(fitsfile.initialise(block) == FAILURE){
-	std::cerr << "Could not open PSRFITS file "
-		  << fitsfile.getFITSname()
-		  << ".\nExiting...\n";
-	return 1;
-      }
-
-      do{
-
-	if(fitsfile.getFilestate()==OPEN) fitsfile.writeSubintRow(block);
-
-	oldBeam = newBeam;
-	oldMoveFlag = newMoveFlag;
- 	
-	// We've done all we can for this block. Read a new one.
-	eof = !block.readBlock(fin);
-
-	if(!eof){ // if the file is still open
-      
-	  bool fileFull = fitsfile.fitsFull(block) ;
-
-	  // get info on the new block
-	  newBeam     = block.getKeyword<int>(IBEAM);
-	  newMoveFlag = block.telescopeOK();
-      
-	  if((newBeam != oldBeam) || fileFull ){
-	    //if we've moved, or it's a new beam, close the file.
-	    fitsfile.closeFile();
-	  }
-
-	  if(newMoveFlag){
-
-	    if(!oldMoveFlag){
-	      // if this is true, then we were moving but now are not.
-	      // this means it is a new file.
-	      fitsfile.setNewFile();
-	    }
-
-	    if( fitsfile.getFilestate()==CLOSED ){
-	      // if there is no file open, but we are not moving, 
-	      //  open a new file
-	      fitsfile.initialise(block);
-	  
-	    }
-
-	  }
-
-	}
-	
-      }while(!eof);
-  
-      fitsfile.closeFile();
-      fin.close();
-
-    } // end of if(doThisOne) clause
-
-  } // end loop over namelist
-
-  return 0;
-
-}
Index: unk/src/pvofixfilename.cc
===================================================================
--- /trunk/src/pvofixfilename.cc	(revision 486)
+++ 	(revision )
@@ -1,104 +1,0 @@
-#include <iostream>
-#include <sstream>
-#include <fitsio.h>
-#include <vector>
-#include <string>
-
-#include "pvo.hh"
-#include "pvo-utils.hh"
-#include "pvo-block.hh"
-#include "pvo-header.hh"
-#include "pvo-FITS.hh"
-
-using namespace PVO;
-using namespace PVO::Header;
-using namespace PVO::Block;
-using namespace PVO::FITS;
-
-
-int main(int argc, char *argv[])
-{
-  if(argc>1){
-    std::cerr << PVO::pvofixfilename_usage_text;
-    return 0;
-  }
-  else{
-
-    std::vector<std::string> namelist = PVO::getAllFitsFiles();
-    std::vector<std::string> execlist,changelist;
-    unsigned int i;
-
-    for(i=0;i<namelist.size();i++){
-
-      PSRFits fitsfile;
-      fitsfile.setVerbosity(true);
-      int status = fitsfile.openFile(namelist[i],READONLY);
-
-      if(status==0){
-
-	std::string obs_mode,hdrname="OBS_MODE";
-	status = fitsfile.getKeyword<std::string>(hdrname, obs_mode);
-	obs_mode = deblank(obs_mode);
-      
-	if(status==0){
-	  if((obs_mode!="PSR")&&(obs_mode!="SEARCH"))
-	    std::cout << "Warning: " << namelist[i]
-		      << " has a non-standard OBS_MODE keyword: '"
-		      << obs_mode << "'\n";
-	  if(obs_mode=="PSR"){
-	    std::stringstream systemcall,change;
-	    std::string newname = namelist[i];
-
-	    size_t dot = newname.rfind('.');
-	    if(dot!=std::string::npos){
-	      if(newname.substr(dot,newname.size())!=".rf"){
-		newname.replace(dot, newname.size(),".rf");
-		systemcall << "mv " << namelist[i] << " " << newname;
-		execlist.push_back(systemcall.str());
-		change << namelist[i] << " --> " << newname;
-		changelist.push_back(change.str());
-	      }
-	    }
-	    else{ // there is no extension in the filename, so add one.
-	      systemcall << "mv " << namelist[i] << " " << namelist[i]<<".rf";
-	      execlist.push_back(systemcall.str());
-	      change << namelist[i] << " --> " << namelist[i]<<".rf";
-	      changelist.push_back(change.str());
-	    }
-	  }
-	}
-	else std::cout << namelist[i] << " NO OBS_MODE KEYWORD!\n";
-
-      }
-      else {
-	std::stringstream errmsg;
-	errmsg << "Error opening file " << namelist[i] << "\n";
-	PVOError("namechange" , errmsg.str() );
-      }
-
-      if(fitsfile.closeFile()!=0){
-	std::stringstream errmsg;
-	errmsg << "Error closing file " << namelist[i] << "\n";
-	PVOError("namechange" , errmsg.str() );
-      }
-
-    }
-
-    if(execlist.size()>0){
-      std::cout << "\nA total of " << execlist.size()
-		<<" files need to have their names changed. "
-		<<"The changes will be:\n";
-      for(i=0;i<execlist.size();i++) std::cout << changelist[i] << "\n";
-    
-      char ans;
-      std::cout << "\nProceed? (y/n) : " 
-		<< std::flush;
-      std::cin >> ans;
-      if(ans=='y'){
-	for(i=0; i<execlist.size();i++) system(execlist[i].c_str());
-      }  
-    }
-    else std::cout << "\nNo files needed to be changed.\n";
-
-  }
-}
Index: unk/src/pvosummary.cc
===================================================================
--- /trunk/src/pvosummary.cc	(revision 486)
+++ 	(revision )
@@ -1,154 +1,0 @@
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <iomanip>
-#include <string>
-#include <unistd.h>
-#include <getopt.h>
-#include "pvo.hh"
-#include "pvo-block.hh"
-#include "pvo-header.hh"
-#include "pvo-FITS.hh"
-#include "pvo-utils.hh"
-#include "pvo-metadata.hh"
-
-using namespace PVO;
-using namespace PVO::Header;
-using namespace PVO::Block;
-using namespace PVO::FITS;
-using namespace PVO::Meta;
-using std::string;
-
-
-int main(int argc, char * argv[])
-{
-  /** 
-   * PVOSummary is a function to print out basic information for
-   * PSRFITS files.
-   *
-   * This program is a command-line program that looks at PSRFITS
-   * files (i.e. files that have extensions .fits, .rf or .sf) and
-   * returns a summary of their positions, beam sizes and observation
-   * times.
-   *
-   * The format of usage is: <br> 
-   * <tt>> pvosummary </tt><br>
-   * to analyse all PSRFITS files in the current directory, or <br>
-   * <tt>> pvosummary FILE</tt><br>
-   * to analyse the file FILE (more than one file can be given). 
-   * Entering<br>
-   * <tt>> pvosummary -h</tt><br>
-   * will give a help message, using PVO::pvosummary_usage_text.
-   *
-   * A fuller list of parameters can be written to a csv
-   * (comma-separated-values) format file by using the <tt>-c</tt>
-   * option, eg:<br>
-   * <tt>> pvosummary -c summary.csv</tt>, or <br>
-   * <tt>> pvosummary -c summary.csv FILE</tt><br>
-   * The list of parameters printed to the csv file can be seen
-   * with:<br>
-   * <tt>> pvosummary -p</tt><br>
-   *
-   * The output is a list of valid files, their central RA & DEC,
-   * their beam size, the central observing frequency, the requested
-   * scan length, and the DATE-OBS keyword (time/date of observation),
-   * 
-   */
-
-
-  bool verboseflag = false;
-  bool makeCSV = false;
-  bool quietMode = false;
-  std::string csvFile;
-
-  std::vector<std::string> namelist;
-  unsigned int i;
-
-  int c;
-  while (true) {
-    int option_index = 0;
-    static struct option long_options[] = {
-      {"help", 0, 0, 'h'},
-      {"csv", 1, 0, 'c'},
-      {"verbose", 1, 0, 'V'},
-      {"version", 1, 0, 'v'},
-      {0, 0, 0, 0}
-    };
-
-    c = getopt_long (argc, argv, "c:hpqvV",
-		     long_options, &option_index);
-
-    if (c == -1) break;
-    
-    switch (c) {               
-    case 0:
-      // This is where we deal with -- options that don't have a
-      // single letter equivalent
-      break;
-    case 'c': // make a csv file.
-      makeCSV = true;
-      csvFile = optarg;
-      break;
-    case 'h': // give help statement
-      std::cout << pvosummary_usage_text;
-      return 0;
-      break;
-    case 'p': // list the parameters
-      std::cout << Meta::metadataList;
-      return 0;
-      break;
-    case 'v': // return version number
-      std::cout << PVO::PVOSUMMARY << " version " << PVO::PVO_VERSION << "\n";
-      return 0;
-      break;
-    case 'V': // use verbose mode -- full verbosity for error messages
-      verboseflag = true;
-      break;
-    case 'q': // quiet mode -- nothing written to screen
-      quietMode = true;
-      break;
-    case '?': // invalid option
-    case ':': // missing an argument
-      std::cout << pvosummary_usage_text_short;
-      return 1;
-      break;
-    default:
-      std::cerr << "ERROR: getopt returned character code " <<  c << "\n";
-      break;
-    }
-
-  }
-
-  if (optind < argc) { 
-    // There is a non-option argument -- must be the file to access
-    while (optind < argc) namelist.push_back( argv[optind++] );
-  }
-  else{ 
-    //No file has been specified, so we are working on the directory
-    //as a whole.
-    namelist = PVO::getAllFitsFiles();
-  }
-
-  std::vector<Metadata> goodlist;
-
-  for(i=0;i<namelist.size();i++){
-
-    PSRFits fitsfile;
-    fitsfile.setVerbosity(verboseflag);
-    int status = fitsfile.openFile(namelist[i],READONLY);
-  
-    if(status==0){
-      Metadata newmatch;
-      newmatch.define(fitsfile);
-      goodlist.push_back(newmatch);
-    }
-
-    fitsfile.closeFile();
-
-  }
-
-  if(!quietMode) printMetadataShort(std::cout,goodlist);
-
-  if(makeCSV) printMetadataFull(csvFile, goodlist);
-
-}
Index: unk/src/pvotapesummary.cc
===================================================================
--- /trunk/src/pvotapesummary.cc	(revision 486)
+++ 	(revision )
@@ -1,178 +1,0 @@
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <iomanip>
-#include <string>
-#include <glob.h>
-#include <unistd.h>
-#include <getopt.h>
-#include "pvo.hh"
-#include "pvo-block.hh"
-#include "pvo-header.hh"
-#include "pvo-utils.hh"
-using namespace PVO;
-using namespace PVO::Header;
-using namespace PVO::Block;
-using std::string;
-
-int main(int argc, char * argv[])
-{
-  /** 
-   * S70Summary is a function to print out basic information for
-   * 70cm survey tape files
-   *
-   * This program is a command-line program that looks at existing
-   * survey files and returns a summary of their starting positions, 
-   * observation times and moving flags
-   *
-   * The format of usage is: <br> 
-   * <tt>> pvotapesummary </tt><br>
-   * to analyse all files in the current directory, or <br>
-   * <tt>> pvotapesummary -d DIR</tt><br>
-   * to analyse all files in directory DIR
-   * Entering<br>
-   * <tt>> pvotapesummary -h</tt><br>
-   * will give a help message, using PVO::pvotapesummary_usage_text.
-   *
-   * The output is a list of valid files, the central RA & DEC of the
-   * first block, the central observing frequency, the requested scan
-   * length, the time/date of observation, and the moving flag.
-   * 
-   */
-
-  int c;
-  unsigned int i;
-  glob_t globbuf;
-  std::vector<std::string> namelist;
-  std::string directory,filenames;
-  while (true) {
-    int option_index = 0;
-    static struct option long_options[] = {
-      {"help", 0, 0, 'h'},
-      {0, 0, 0, 0}
-    };
-
-    c = getopt_long (argc, argv, "hd:",
-		     long_options, &option_index);
-
-    if (c == -1) break;
-    
-    switch (c) {               
-    case 0:
-      // This is where we deal with -- options that don't have a
-      // single letter equivalent
-      break;
-    case 'h': // give help statement
-      std::cout << pvotapesummary_usage_text;
-      return 0;
-      break;
-    case 'd':
-      directory = optarg;
-      filenames = directory + "/*";
-      globbuf.gl_offs = 0;
-      glob(filenames.c_str(), GLOB_DOOFFS, NULL, &globbuf);
-      namelist.resize(globbuf.gl_pathc);
-      for(i=0;i<globbuf.gl_pathc+globbuf.gl_offs;i++) {
-	namelist[i] = globbuf.gl_pathv[i];
-      }
-      break;
-    case '?': // invalid option
-    case ':': // missing an argument
-      std::cout << pvotapesummary_usage_text;
-      return 1;
-      break;
-    default:
-      std::cerr << "ERROR: getopt returned character code " <<  c << "\n";
-      break;
-    }
-
-  }
-  
-  while (optind < argc) { 
-    // There are non-option arguments -- must be the files to look at
-     namelist.push_back(argv[optind++]);
-  }
-
-  std::vector<std::string> goodlist;
-  for(i=0; i<namelist.size(); i++)
-    if(idSurvey(namelist[i]) != DUD) goodlist.push_back(namelist[i]);
-  
-  int filenameSize = 8; // size of "FILENAME"
-  for(i=0;i<goodlist.size();i++) 
-    filenameSize = std::max(filenameSize,int(goodlist[i].size()));
-    
-  std::cout << std::setfill('-')  
-// 	    << std::setw(filenameSize+1+15+15+31+11+11+11+5) << "-";
-	    << std::setw(filenameSize+1+15+15+31+11+11+11+5+65) << "-";
-
-  std::cout << "\n" << std::setfill(' ') 
-	    << std::setw(filenameSize) << "FILENAME"  << " "
-	    << std::setw(14)           << "RAJ"       << " "
-	    << std::setw(14)           << "DECJ"      << " "
-	    << std::setw(10)           << "OBSFREQ"   << " "
-	    << std::setw(10)           << "CHANBW"    << " "
-	    << std::setw(10)           << "SCANLEN"   << " "
-	    << std::setw(4)            << "MOVE"      << " "
-// 	    << std::setw(30)           << "DATE-OBS\n";
-	    << std::setw(30)           << "DATE-OBS"  << " "
-	    << std::setw(64)           << "COMMENT\n";
-     
-  std::cout << std::setw(filenameSize) << ""      << " "
-	    << std::setw(14)           << ""      << " "
-	    << std::setw(14)           << ""      << " "
-	    << std::setw(10)           << "[MHz]" << " "
-	    << std::setw(10)           << "[MHz]" << " "
-	    << std::setw(10)           << "[s]"   << " "
-	    << std::setw(4)            << ""      << " "
-// 	    << std::setw(30)           << "\n";
- 	    << std::setw(30)           << ""      << " "
- 	    << std::setw(30)           << "\n";
-
-  std::cout<< std::setfill('-')  
-// 	   << std::setw(filenameSize+1+15+15+31+11+11+11+5) << "-";
-	   << std::setw(filenameSize+1+15+15+31+11+11+11+5+65) << "-";
-  std::cout<< "\n"<< std::setfill(' ') ;
-    
-  for(i=0;i<goodlist.size();i++){
-
-    std::ifstream fin;
-    fin.open(goodlist[i].c_str(), std::ios::binary);
-    DataBlock block(S70);
-    block.readBlock(fin);
-    std::string ra       = deblank(block.getKeyword<std::string>(RA));
-    std::string dec      = deblank(block.getKeyword<std::string>(DEC));
-    float scanlen        = block.getKeyword<float>(SCAN_LEN);
-    int move             = block.getKeyword<int>(MOVE);
-    std::string date_obs = 
-      makeDateObs(deblank(block.getKeyword<std::string>(DATE)),
-		  deblank(block.getKeyword<std::string>(UT))   );
-    double f0            = block.getKeyword<double>(FREQ_CHAN1);
-    double bw            = block.getKeyword<double>(CHANBW);
-    double nc            = block.getKeyword<double>(NCHAN);
-    float obsfreq        = f0 + ((nc-1)/2.) * bw;
-    std::vector<std::string> commentfields  = block.getFullKeyword<std::string>(COMMENT);
-    std::string comment;
-    if(commentfields.size()>0){
-      comment = commentfields[0];
-      for(int j=1;j<commentfields.size();j++) 
-	comment += " " + commentfields[j];
-    }
-
-    std::cout.setf(std::ios::fixed);
-    std::cout << std::setw(filenameSize) << goodlist[i] << " "
-	      << std::setw(14)           << ra          << " "
-	      << std::setw(14)           << dec         << " "
-	      << std::setprecision(4)
-	      << std::setw(10)           << obsfreq     << " "
-	      << std::setw(10)           << bw          << " "
-	      << std::setw(10)           << scanlen     << " "
-	      << std::setw(4)            << move        << " " 
-// 	      << std::setw(30)           << date_obs    << "\n";
-	      << std::setw(30)           << date_obs    << " "
-	      << std::setw(64)           << comment     << "\n";
-
-    fin.close();
-  }
-
-}
-
Index: /trunk/src/tests/blocktest.cc
===================================================================
--- /trunk/src/tests/blocktest.cc	(revision 486)
+++ /trunk/src/tests/blocktest.cc	(revision 1)
@@ -2,6 +2,6 @@
 #include <fstream>
 #include <string>
-#include "../pvo-block.hh"
-#include "../pvo-header.hh"
+#include "../Block.hh"
+#include "../Header.hh"
 
 using namespace Header;
Index: unk/src/tests/globtest.c
===================================================================
--- /trunk/src/tests/globtest.c	(revision 486)
+++ 	(revision )
@@ -1,26 +1,0 @@
-#include <stdio.h>
-#include <glob.h>
-
-int main(){
-
-  glob_t globbuf;
-  int i;
-
-/*   globbuf.gl_offs = 2; */
-  globbuf.gl_offs = 0;
-/*   glob("*.c", GLOB_DOOFFS, NULL, &globbuf); */
-/*   glob("src/\*.cc", GLOB_DOOFFS, NULL, &globbuf); */
-/*   glob("*.fits", GLOB_DOOFFS, NULL, &globbuf); */
-  glob("*.rf", GLOB_DOOFFS, NULL, &globbuf);
-/*   glob("../\*.c", GLOB_DOOFFS | GLOB_APPEND, NULL, &globbuf); */
-
-  printf("%d\n",globbuf.gl_pathc);
-/*   for(i=0;i<globbuf.gl_pathc;i++) printf("%s\n",globbuf.gl_pathv[i]); */
-  for(i=0;i<globbuf.gl_pathc+globbuf.gl_offs;i++) 
-    printf("%s\n",globbuf.gl_pathv[i]);
-
-/*   globbuf.gl_pathv[0] = "ls"; */
-/*   globbuf.gl_pathv[1] = "-l"; */
-/*   execvp("ls", &globbuf.gl_pathv[0]); */
-
-}
Index: /trunk/src/tests/headertest.cc
===================================================================
--- /trunk/src/tests/headertest.cc	(revision 486)
+++ /trunk/src/tests/headertest.cc	(revision 1)
@@ -1,4 +1,4 @@
 #include <iostream>
-#include "../pvo-header.hh"
+#include "../Header.hh"
 
 using namespace Header;
@@ -8,5 +8,5 @@
   try{
     std::cout <<"S70: ";
-    SurveySchema survey1(S70);
+    SurveySchema survey1("S70");
     std::cout << survey1.getStartPosition(FREQ_CHAN1) << std::endl;
     std::cout << survey1.readParameter<int>(hdrtest,TAPENR) << std::endl;
@@ -23,18 +23,14 @@
 		<< survey1.getFieldDimension(STATUS) << "\n";
     }
-    std::cout << "ANT_X = " << survey1.getAntX() <<"\n";
-    std::cout << "FD_POLN = " << survey1.getFd_poln() <<"\n";
-    std::cout << "FD_XYPH = " << survey1.getFd_xyph() <<"\n";
-    std::cout << "TCYCLE = " << survey1.getTcycle() << "\n";
 
     std::cout <<"PM : ";
-    SurveySchema survey2(PM);
+    SurveySchema survey2("PM");
     std::cout << survey2.getStartPosition(FREQ_CHAN1) << std::endl;
     std::cout << survey2.readParameter<int>(hdrtest,TAPENR) << std::endl;
     
-//     std::cout <<"BOB: ";
-//     SurveySchema survey3("BOB");
-//     std::cout << survey3.getStartPosition(FREQ_CHAN1) << std::endl;
-//     std::cout << survey3.readParameter<int>(hdrtest,TAPENR) << std::endl;
+    std::cout <<"BOB: ";
+    SurveySchema survey3("BOB");
+    std::cout << survey3.getStartPosition(FREQ_CHAN1) << std::endl;
+    std::cout << survey3.readParameter<int>(hdrtest,TAPENR) << std::endl;
  }
   catch(SurveySchema::xBadSurvey bad){
Index: unk/src/tests/makeFakeData.cc
===================================================================
--- /trunk/src/tests/makeFakeData.cc	(revision 486)
+++ 	(revision )
@@ -1,161 +1,0 @@
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <vector>
-#include <string>
-#include "../pvo-block.hh"
-#include "../pvo-header.hh"
-#include "../pvo-FITS.hh"
-#include "../pvo-utils.hh"
-using namespace Header;
-using namespace Block;
-using namespace FITS;
-
-int main()
-{
-  const int patternSize = 7
-  int pattern[patternSize] = {1,1,2,3,5,8,13};
-  std::stringstream ss;
-
-  // DO 1-BIT DATA.
-  // has nchan = 8, samp_grp = 5, grp_blk = 1
-  vector<bool> bindata1(40);
-  int place=0;
-  for(int i=0;i<patternSize;i++){
-    bindata1[place++] = false;
-    for(int j=0;j<pattern[i];j++) bindata1[place++] = true;
-  }
-  for(int i=0;i<bindata1.size();i++) std::cout << bindata1[i];
-  std::cout << endl;
-  std::string binstring1 = binaryToString(bindata1);
-  std::cout << binstring1 <<endl;
-
-  char *data = new char[Block::dataLength];
-  for(int i=0;i<bindata1.size();i++) data[i] = binstring1[i];
-  for(int i=bindata1.size();i<Block::dataLength;i++) data[i] = 0;
-  ss.str("");
-  ss << "cp data/dummy_header_s70_1bit.dat data/fakedata_s70_1bit.dat";
-  std::cerr << "Executing command: " << ss.str() << endl;
-  system(ss.str().c_str());
-  ofstream fdata;
-  fdata.open("data/fakedata_s70_1bit.dat",ios_base::binary | ios::app);
-  fdata << data;
-  fdata.close();
-
-//   std::string fhead = "data/dummy_header_s70_1bit.dat";
-//   ifstream headfile(fhead.c_str());
-//   DataBlock block1(idSurvey(fhead));
-//   block1.readHeader(headfile);
-//   block1.saveData((char *)binstring1.c_str(),binstring1.size());
-//   PSRFits fitsfile1;
-//   fitsfile1.initialise(block1);
-//   std::string name = fitsfile1.getFITSname();
-//   fitsfile1.writeSubintRow(block1);
-//   fitsfile1.closeFile();
-//   headfile.close();
-//   std::stringstream ss;
-//   ss << "mv " << name << " data/fakedata_1bit.fits";
-//   std::cerr << "Executing command: " << ss.str() << endl;
-//   system(ss.str().c_str());
-
-  //------------------------------------------------------------
-  // DO 2-BIT DATA.
-  vector<int> bindata2(40);
-  place=0;
-  for(int i=0;i<patternSize;i++){
-    int valuectr=0;
-    bindata2[place++] = 0;
-    for(int j=0;j<pattern[i];j++) bindata2[place++] = (valuectr++)%3 + 1;
-  }
-  for(int i=0;i<bindata2.size();i++) std::cout << bindata2[i];
-  std::cout << endl;
-  vector<bool> bindata2b(80);
-  for(int i=0;i<40;i++){
-    bindata2b[i*2] = bindata2[i]/2;
-    bindata2b[i*2+1] = bindata2[i]%2;
-  }
-  for(int i=0;i<bindata2b.size();i++) std::cout << bindata2b[i];
-  std::cout << endl;
-  std::string binstring2 = binaryToString(bindata2b);
-  std::cout << binstring2 <<endl;
-
-  for(int i=0;i<bindata2.size();i++) data[i] = binstring2[i];
-  for(int i=bindata2.size();i<Block::dataLength;i++) data[i] = 0;
-  ss.str("");
-  ss << "cp data/dummy_header_s70_2bit.dat data/fakedata_s70_2bit.dat";
-  std::cerr << "Executing command: " << ss.str() << endl;
-  system(ss.str().c_str());
-  fdata.open("data/fakedata_s70_2bit.dat",ios_base::binary | ios::app);
-  fdata << data;
-  fdata.close();
-
-//   fhead = "data/dummy_header_s70_2bit.dat";
-//   headfile.open(fhead.c_str());
-//   DataBlock block2(idSurvey(fhead));
-//   block2.readHeader(headfile);
-//   block2.saveData((char *)binstring2.c_str(),binstring2.size());
-//   PSRFits fitsfile2;
-//   fitsfile2.initialise(block2);
-//   name = fitsfile1.getFITSname();
-//   fitsfile2.writeSubintRow(block2);
-//   fitsfile2.closeFile();
-//   headfile.close();
-//   ss.str("");
-//   ss << "mv " << name << " data/fakedata_2bit.fits";
-//   system(ss.str().c_str());
-
-  //------------------------------------------------------------
-  // DO 4-BIT DATA.
-  std::string bindata4(40,'0');
-  std::string values4="123456789abcdef";
-  vector<int> bindata4int(40);
-  place=0;
-  int intplace=0;
-  for(int i=0;i<patternSize;i++){
-    int valuectr=0;
-    bindata4[place++] = '0';
-    bindata4int[intplace++] = 0;
-    for(int j=0;j<pattern[i];j++) bindata4[place++] = values4[(valuectr++)%15];
-    valuectr=0;
-    for(int j=0;j<pattern[i];j++) bindata4int[intplace++] = (valuectr++)%15 + 1;
-  }
-  std::cout << bindata4 << endl;
-  vector<bool> bindata4b(160);
-  for(int i=0;i<40;i++){
-    
-    bindata4b[i*4]   = bindata4int[i]/8;
-    bindata4b[i*4+1] = bindata4int[i]/4;
-    bindata4b[i*4+2] = bindata4int[i]/2;
-    bindata4b[i*4+3] = bindata4int[i]%2;
-  }
-  for(int i=0;i<bindata4b.size();i++) std::cout << bindata4b[i];
-  std::cout << endl;
-  std::string binstring4 = binaryToString(bindata4b);
-  std::cout << binstring4 <<endl;
-
-  for(int i=0;i<bindata4.size();i++) data[i] = binstring4[i];
-  for(int i=bindata4.size();i<Block::dataLength;i++) data[i] = 0;
-  ss.str("");
-  ss << "cp data/dummy_header_s70_4bit.dat data/fakedata_s70_4bit.dat";
-  std::cerr << "Executing command: " << ss.str() << endl;
-  system(ss.str().c_str());
-  fdata.open("data/fakedata_s70_4bit.dat",ios_base::binary | ios::app);
-  fdata << data;
-  fdata.close();
-
-//   fhead = "data/dummy_header_s70_4bit.dat";
-//   headfile.open(fhead.c_str());
-//   DataBlock block4(idSurvey(fhead));
-//   block4.readHeader(headfile);
-//   block4.saveData((char *)binstring4.c_str(),binstring4.size());
-//   PSRFits fitsfile4;
-//   fitsfile4.initialise(block4);
-//   name = fitsfile1.getFITSname();
-//   fitsfile4.writeSubintRow(block4);
-//   fitsfile4.closeFile();
-//   headfile.close();
-//   ss.str("");
-//   ss << "mv " << name << " data/fakedata_4bit.fits";
-//   system(ss.str().c_str());
-
-}
Index: /trunk/src/tests/psrfitstest.cc
===================================================================
--- /trunk/src/tests/psrfitstest.cc	(revision 486)
+++ /trunk/src/tests/psrfitstest.cc	(revision 1)
@@ -2,7 +2,7 @@
 #include <fstream>
 #include <string>
-#include "../pvo-block.hh"
-#include "../pvo-header.hh"
-#include "../pvo-FITS.hh"
+#include "../Block.hh"
+#include "../Header.hh"
+#include "../PSRFits.hh"
 
 using namespace Header;
Index: /trunk/src/tests/s70FullTest.cc
===================================================================
--- /trunk/src/tests/s70FullTest.cc	(revision 486)
+++ /trunk/src/tests/s70FullTest.cc	(revision 1)
@@ -4,7 +4,7 @@
 #include <iomanip>
 #include <string>
-#include "../pvo-block.hh"
-#include "../pvo-header.hh"
-#include "../pvo-FITS.hh"
+#include "../Block.hh"
+#include "../Header.hh"
+#include "../PSRFits.hh"
 
 using namespace Header;
@@ -12,14 +12,4 @@
 using namespace FITS;
 using std::string;
-
-ISMOVING moveStatus(std::string file)
-{
-  std::ifstream fin;
-  fin.open(file.c_str(), std::ios::binary);
-  DataBlock block(idSurvey(file));
-  block.readBlock(fin);
-  fin.close();
-  return ISMOVING(block.getKeyword<int>(MOVE));
-}
 
 std::string getFileName(int number)
@@ -33,5 +23,5 @@
 {
   std::string fname;
-  if(argc==1) fname = "data/s70_tape_test_S181_S18101.dat";
+  if(argc==1) fname = "../data/s70_tape_test_S181_S18101.dat";
   else if(argc==2) fname = argv[1];
   else{
@@ -43,31 +33,12 @@
 
   if(currentSurvey == PM){
-    std::cerr <<"\aOops! This is a PM survey!\n Good, but not for this program\nExiting...\n"; 
+    std::cerr <<"\aOops! This is a PM survey!\n Good, but not for this program\nExiting...\n";
   }
   if(currentSurvey != S70){
     if(currentSurvey!=PM)
-      std::cerr <<"\aOops! This isn't an S70 survey file!\nExiting...\n";
+      std::cerr <<"\aOops! This isn't an S70 survey!\nExiting...\n";
     return 1;
   }
   else std::cerr <<"Yes! This is an S70 survey file. Go ahead...\n";
-
-  ISMOVING status = moveStatus(fname);
-  if(status == NOTGRID){
-    std::cerr <<"\aOops! This is not a gridded observation -- and so not a survey\nExiting...";
-    return 1;
-  }
-  else if(status == SCANNING){
-    std::cerr <<"\aOops! This is a scanning observation -- how did that happen?\nExiting...";
-    return 1;
-  }
-  else if(status == MOVING)
-    std::cerr <<"OK... we are moving, but carry on in case we stop...\n";
-  else if(status == POINT)
-    std::cerr <<"Excellent... a pointed observation. Let's go!\n";
-  else{
-    std::cerr <<"\a\a\aOops! status is an unknown value (" 
-	      << status << ")\nExiting...\n";
-    return 1;
-  }
 
   std::ifstream fin;
@@ -76,19 +47,10 @@
   bool eof;
   DataBlock block(currentSurvey);
-  std::cerr << block.Survey().getAntX() << "\n";
-  SurveySchema testsurv(currentSurvey);
-  std::cerr << testsurv.getAntX() << "\n";
-  
   block.readBlock(fin);
   
-  std::string currentRA = block.getKeyword<std::string>(RA);
+  std::string currentRA = block.getKeyword<std::string>(RA_STRT);
 
   int filecount = 0;
-//   PSRFits fitsfile(getFileName(filecount++));
-  PSRFits fitsfile;
-  if(fitsfile.openFile(block)) {
-    std::cerr << "\aCannot open file.\nExiting...\n";
-    return 1;
-  }
+  PSRFits fitsfile(getFileName(filecount++));
   fitsfile.writePHU(block);
   
@@ -98,8 +60,5 @@
     if(block.getKeyword<int>(MOVE)!=MOVING) {
       std::cerr << "block " << blockcount++;
-      if(fitsfile.writeSubint(block)){
-	std::cerr << "Error. Exiting...\n";
-	return 1;
-      }
+      fitsfile.writeSubint(block);
       std::cerr << " done\n";
     }
@@ -107,10 +66,10 @@
 
     std::cerr << currentRA << " "
-	      << block.getKeyword<std::string>(RA) << " "
+	      << block.getKeyword<std::string>(RA_STRT) << " "
 	      << block.getKeyword<int>(MOVE) <<" ";
 
     if(!eof){
 
-      if((block.getKeyword<std::string>(RA) != currentRA)
+      if((block.getKeyword<std::string>(RA_STRT) != currentRA)
 	 || (block.getKeyword<int>(MOVE)==MOVING)){
 	std::cerr << "Changing FITS file -- " << filecount << "\n";
@@ -120,8 +79,7 @@
       if((fitsfile.getFilestate()==CLOSED)
 	 &&(block.getKeyword<int>(MOVE)==POINT)){
-// 	fitsfile.openFile(getFileName(filecount++));
-	fitsfile.openFile(block);
+	fitsfile.openFile(getFileName(filecount++));
 	fitsfile.writePHU(block);
-	currentRA = block.getKeyword<std::string>(RA);
+	currentRA = block.getKeyword<std::string>(RA_STRT);
       }
 
@@ -135,4 +93,4 @@
   fitsfile.closeFile();
   fin.close();
-  std::cerr << "\n";
+
 }
Index: unk/src/tests/testAngSepFunctions.cc
===================================================================
--- /trunk/src/tests/testAngSepFunctions.cc	(revision 486)
+++ 	(revision )
@@ -1,153 +1,0 @@
-#include <iostream>
-#include <iomanip>
-#include <cpgplot.h>
-#include <stdlib.h>
-#include <time.h>
-#include <math.h>
-#include <Utils/mycpgplot.hh>
-#include <pvo-utils.hh>
-using namespace mycpgplot;
-using namespace PVO;
-double angSepStd(double ra1, double dec1, double ra2, double dec2);
-double angSepHav(double ra1, double dec1, double ra2, double dec2);
-int main()
-{
-  
-//   const int num=10000000;
-
-  srandom(time(0));
-
-  const int num=100000;
-  float std[num],hav[num];
-  float min,max;
-
-  const float ramax = 1.;
-  const float demax = 1.;
-
-  double ra1  = dmsToDec("18:43:22.0")*15.;
-  double dec1 = dmsToDec("89:52:12.3");
-  double ra2  = dmsToDec("18:43:22.0")*15.;
-  double dec2 = dmsToDec("89:52:12.1");
-  
-  std::cout << std::setprecision(10);
-  std::cout << "Std result =\t" << angSepStd(ra1,dec1,ra2,dec2) << "\n";
-  std::cout << "Hav result =\t" << angSepHav(ra1,dec1,ra2,dec2) << "\n";
-  std::cout << "Should get  \t" << 0.2/3600. << "\n";
-
-  for(int i=0;i<num;i++){
-    
-    ra1  = ramax * rand() / (RAND_MAX+1.);
-    dec1 = demax * rand() / (RAND_MAX+1.) - demax/2.;
-    ra2  = ramax * rand() / (RAND_MAX+1.);
-    dec2 = demax * rand() / (RAND_MAX+1.) - demax/2.;
-
-//     float std = angSepStd(ra1,dec1,ra2,dec2);
-//     float hav = angSepHav(ra1,dec1,ra2,dec2);
-
-    std[i] = angSepStd(ra1,dec1,ra2,dec2);
-    hav[i] = angSepHav(ra1,dec1,ra2,dec2);
-
-    if(i==0) min=max=std[i];
-    else{
-      min=std::min(min,std[i]);
-      max=std::max(max,std[i]);
-    }
-    min=std::min(min,hav[i]);
-    max=std::max(max,hav[i]);
-
-    if(fabsf(std[i]-hav[i])>5.e-9){
-      std::cout << "(" << ra1 << "," << dec1<< ") vs. (" << ra2 << "," << dec2 << ")"
-		<< "  " << std[i] << " " << hav[i] << "\n";
-    }
-
-  }
-
-  cpgopen("/vcps");
-  cpgpap(8.,1.);
-  cpgenv(min,max,min,max,0,0);
-  cpglab("Standard way", "Haversine Formula","");
-  cpgpt(num,std,hav,SOLIDCIRCLE);
-  cpgmove(min,min);
-  cpgdraw(max,max);
-
-  float resid[num],rmin,rmax;
-  for(int i=0;i<num;i++){
-    resid[i] = std[i] - hav[i];
-//     if(i==0) rmin=max=resid[i];
-//     else{
-//       rmin=std::min(rmin,resid[i]);
-//       rmax=std::max(rmax,resid[i]);
-//     }
-  }
-  rmin = -1.e-6;
-  rmax = 1.e-6;
-  cpgenv(min,max,rmin,rmax,0,0);
-  cpglab("Standard way", "Standard - Haversine","");
-  cpgpt(num,std,resid,SOLIDCIRCLE);
-  cpgmove(min,0);
-  cpgdraw(max,0);
-
-  for(int i=0;i<num;i++){
-    std[i] = log10(std[i]);
-    hav[i] = log10(hav[i]);
-    resid[i] = std[i] - hav[i];
-//     if(i==0) rmin=max=resid[i];
-//     else{
-//       rmin=std::min(rmin,resid[i]);
-//       rmax=std::max(rmax,resid[i]);
-//     }
-  }
-  cpgenv(log10(min),log10(max),log10(min),log10(max),0,30);
-  cpglab("log10(Standard way)", "log10(Haversine Formula)","");
-  cpgpt(num,std,hav,SOLIDCIRCLE);
-  cpgmove(log10(min),log10(min));
-  cpgdraw(log10(max),log10(max));
-
-  
-  cpgenv(log10(min),log10(max),rmin,rmax,0,10);
-  cpglab("log10(Standard way)", "log10(Standard/Haversine)","");
-  cpgpt(num,std,resid,SOLIDCIRCLE);
-  cpgmove(log10(min),0);
-  cpgdraw(log10(max),0);
-
-  cpgend();
-
-
-}
-
-double angSepStd(double ra1, double dec1, double ra2, double dec2)
-{
-    /**
-     *  This is the "standard" way of calculating the angular separation.
-     */
-    double r1,d1,r2,d2;
-    r1 = ra1  * M_PI / 180.;
-    d1 = dec1 * M_PI / 180.;
-    r2 = ra2  * M_PI / 180.;
-    d2 = dec2 * M_PI / 180.;
-//     std::cerr << cos(r1-r2) << " " << cos(d1) << " " << cos(d2) << " " << sin(d1) << " " << sin(d2) << "\n";
-    double angsep = cos(r1-r2)*cos(d1)*cos(d2) + sin(d1)*sin(d2);
-    
-    return acos(angsep)*180./M_PI;
-}
-
-double angSepHav(double ra1, double dec1, double ra2, double dec2)
-{
-    /**
-     *  This is the way of calculating the angular separation that uses the Haversine formula:
-     *  see http://en.wikipedia.org/wiki/Haversine_formula
-     *  and http://mathforum.org/library/drmath/view/51879.html for derivation.
-     */
-    double r1,d1,r2,d2,diffr,diffd;
-    // put into radians
-    r1 = ra1  * M_PI / 180.;
-    d1 = dec1 * M_PI / 180.;
-    r2 = ra2  * M_PI / 180.;
-    d2 = dec2 * M_PI / 180.;
-    diffr = (r1-r2)/2.;
-    diffd = (d1-d2)/2.;
-//     std::cerr << sin(diffr) << " " << cos(d1) << " " << cos(d2) << " " << sin(diffd) << "\n";
-    double havtheta = sin(diffr)*sin(diffr)*cos(d1)*cos(d2) + sin(diffd)*sin(diffd);
-      
-    return asin(sqrt(havtheta))*2.*180./M_PI;
-}
Index: unk/src/tests/testBitToggle.cc
===================================================================
--- /trunk/src/tests/testBitToggle.cc	(revision 486)
+++ 	(revision )
@@ -1,22 +1,0 @@
-#include "../pvo-utils.hh"
-#include <iostream>
-#include <iomanip>
-using namespace PVO;
-int main()
-{
-
-  unsigned char c = 'z';  // a = 97 = 0x61 = 01100001
-
-  unsigned char d = bitToggle(c);
-
-  std::cout.setf(std::ios::showbase);
-  std::cout << std::hex << uint(c) << " " << uint(d) << "\n";
-
-
-//   for(uint i=0;i<256;i++){
-//     std::cout << std::hex << uint(bitToggle(char(i))) << ", ";
-//     if((i+1)%16==0) std::cout << "\n";
-//   }
-  
-
-}
Index: /trunk/src/tests/testDataAccess.cc
===================================================================
--- /trunk/src/tests/testDataAccess.cc	(revision 486)
+++ /trunk/src/tests/testDataAccess.cc	(revision 1)
@@ -5,7 +5,7 @@
 #include <string>
 #include <vector>
-#include "../pvo-block.hh"
-#include "../pvo-header.hh"
-#include "../pvo-utils.hh"
+#include "../Block.hh"
+#include "../Header.hh"
+#include "../Utils.hh"
 
 using namespace Header;
Index: /trunk/src/tests/testFitsBinTable.cc
===================================================================
--- /trunk/src/tests/testFitsBinTable.cc	(revision 486)
+++ /trunk/src/tests/testFitsBinTable.cc	(revision 1)
@@ -2,5 +2,5 @@
 #include <sstream>
 #include <fitsio.h>
-#include "../pvo-utils.hh"
+#include "../Utils.hh"
 #include <vector>
 #include <string>
@@ -22,12 +22,10 @@
   char *template_file = (char *)getPSRFITSdefn().c_str();
   std::cerr << "opening with template...";
-    fits_create_template(&fptr, "!test.fits", getPSRFITSdefn().c_str(),&status);
+  //  fits_create_template(&fptr, "!test.fits", getPSRFITSdefn().c_str(),&status);
   //  fits_create_template(&fptr, "!test.fits", "simpletemplate.fits",&status);
 //   fits_create_template(&fptr,"!test.fits","combinedtemplate.fits",&status);
-    //fits_create_template(&fptr,"!test.fits","psrheaderSimple.txt",&status);
+  fits_create_template(&fptr,"!test.fits","psrheaderSimple.txt",&status);
   if(status) fits_report_error(stderr, status);
   std::cerr << "done.\n";
-
-  //----------------------------------------------------
 
   std::cerr << "moving to subint hdu...";
@@ -36,6 +34,4 @@
   if(status) fits_report_error(stderr, status);
   std::cerr << "done.\n";
-
-  //----------------------------------------------------
 
   int nch=16;
@@ -53,6 +49,4 @@
   std::cerr << "done.\n";
   
-  //----------------------------------------------------
-
   std::cerr << "fixing format...";
   std::stringstream ss;
@@ -75,6 +69,4 @@
   std::cerr << "done.\n";
 
-  //----------------------------------------------------
-
   std::cerr << "moving to primary hdu...";
   status = 0;
@@ -88,6 +80,4 @@
   std::cerr << "done.\n";
 
-  //----------------------------------------------------
-
   long nrows;
   std::cerr << "getting number of rows...";
@@ -97,5 +87,4 @@
   std::cerr << "num rows=" << nrows << std::endl;
   status=0;
-  std::cerr << "done.\n";
 
   // Add info in the TSUBINT column in the current row
@@ -110,6 +99,4 @@
 //   std::cerr << "done.\n";
   
-  //----------------------------------------------------
-
   std::cerr << "adding data array...";
   std::vector<bool> bin(nch*nbin*npol,false);
@@ -141,15 +128,10 @@
   /* */
   
-  //----------------------------------------------------
-
   std::cerr << "fixing size of vector...";
   status=0;
-  fits_modify_vector_len (fptr, colnum, nch*npol*nbin/8, &status);
-  //  fits_modify_vector_len (fptr, colnum, nch*npol*nbin, &status);
+//   fits_modify_vector_len (fptr, colnum, nch*npol*nbin/8, &status);
+  fits_modify_vector_len (fptr, colnum, nch*npol*nbin, &status);
   if(status) fits_report_error(stderr, status);
   std::cerr << "done.\n";
-
-  //----------------------------------------------------
-
   std::cerr << "fixing dimensions...";
   long naxis=3,naxes[3];
@@ -161,6 +143,4 @@
   if(status) fits_report_error(stderr, status);
   std::cerr << "done.\n";
-
-  //----------------------------------------------------
 
   std::cerr << "writing data...";
@@ -174,6 +154,4 @@
   std::cerr << "done.\n";
   /* */
-  //----------------------------------------------------
-
   std::cerr << "closing...";
   status = 0;
Index: /trunk/src/tests/testFitsBinTableSml.cc
===================================================================
--- /trunk/src/tests/testFitsBinTableSml.cc	(revision 486)
+++ /trunk/src/tests/testFitsBinTableSml.cc	(revision 1)
@@ -2,5 +2,5 @@
 #include <sstream>
 #include <fitsio.h>
-#include "../pvo-utils.hh"
+#include "../Utils.hh"
 #include <vector>
 #include <string>
Index: /trunk/src/tests/testFitsCreation.cc
===================================================================
--- /trunk/src/tests/testFitsCreation.cc	(revision 486)
+++ /trunk/src/tests/testFitsCreation.cc	(revision 1)
@@ -1,6 +1,5 @@
 #include <iostream>
 #include <fitsio.h>
-#include "../pvo-utils.hh"
-using namespace PVO;
+#include "../Utils.hh"
 
 int main()
@@ -15,8 +14,8 @@
   char *template_file = (char *)getPSRFITSdefn().c_str();
   std::cerr << "opening with template...";
-   fits_create_template(&fptr, "!test.fits", template_file, &status);
+//   fits_create_template(&fptr, "!test.fits", getPSRFITSdefn().c_str(),&status);
 //    fits_create_template(&fptr, "!test.fits", "/DATA/SITAR_1/whi550/ObsData/cubes/simulated/gaussianPlusOne.fits",&status);
 //   fits_create_template(&fptr, "!test.fits", "psrheader.txt",&status);
-//  fits_create_template(&fptr, "!test.fits", "simpletemplate.fits",&status);
+  fits_create_template(&fptr, "!test.fits", "simpletemplate.fits",&status);
 //   fits_create_file(&fptr, "!test.fits(simpletemplate.fits)",&status);
   //fits_create_template(&fptr, "!test.fits", "simpletabletemplate.fits",&status);
Index: /trunk/src/tests/testFitsKeywords.cc
===================================================================
--- /trunk/src/tests/testFitsKeywords.cc	(revision 486)
+++ /trunk/src/tests/testFitsKeywords.cc	(revision 1)
@@ -1,5 +1,5 @@
 #include <iostream>
 #include <fitsio.h>
-#include "../pvo-utils.hh"
+#include "../Utils.hh"
 
 int main()
Index: unk/src/tests/testMoving.cc
===================================================================
--- /trunk/src/tests/testMoving.cc	(revision 486)
+++ 	(revision )
@@ -1,64 +1,0 @@
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <iomanip>
-#include <string>
-#include "../pvo-block.hh"
-#include "../pvo-header.hh"
-#include "../pvo-FITS.hh"
-#include "../pvo-utils.hh"
-
-using namespace Header;
-using namespace Block;
-using namespace FITS;
-using std::string;
-
-int main(int argc, char * argv[])
-{
-
-  std::string fname;
-  if(argc==2) fname = argv[1];
-  else{
-    std::cerr << "Usage: \"testMoving.x filename\"...\n";
-    return 1;
-  }
-
-  SURVEY currentSurvey = idSurvey(fname);
-  std::cerr << "File " << fname <<" : " << surveyNames[currentSurvey]<<"\n";
-  if(currentSurvey == DUD){
-    std::cerr << "Exiting...\n";
-    return 1;
-  }
-
-  std::ifstream fin;
-  fin.open(fname.c_str(), std::ios::binary);
-  DataBlock block(currentSurvey);
-  block.readBlock(fin);
-
-  int countGood = 0;
-  int countMove = 0;
-  int countPos = 0;
-
-  do{
-
-    if(block.telescopeOK()){
-      if(countMove>0) {
-	std::cout << "Number of moving blocks = " << countMove << "\n";
-	countMove = 0;
-      }
-      countGood++;
-    }
-    else{
-      if(countGood > 0){
-	std::cout << "Position " << ++countPos << ": "
-		  << "Number of good blocks = " << countGood
-		  << ", stopping at block " << block.getKeyword<int>(BLK_CNTR) 
-		  << "\n";
-	countGood = 0;
-      }
-      countMove++;
-    }
-    
-  } while(block.readBlock(fin));
-
-}
Index: unk/src/tests/testNewPsrfits.cc
===================================================================
--- /trunk/src/tests/testNewPsrfits.cc	(revision 486)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <iomanip>
-#include <string>
-#include "../pvo-block.hh"
-#include "../pvo-header.hh"
-#include "../pvo-FITS.hh"
-#include "../pvo-utils.hh"
-
-using namespace Header;
-using namespace Block;
-using namespace FITS;
-using std::string;
-
-int main()
-{
-  
-  std::string fname = "data/s70_tape_test_S181_S18101.dat";
-  SURVEY currentSurvey = idSurvey(fname);
-
-  std::ifstream fin;
-  fin.open(fname.c_str(), std::ios::binary);
-    
-  DataBlock block(currentSurvey);
-  block.readBlock(fin);
-  
-  PSRFits fitsfile;
-  if(fitsfile.initialise(block) == FAILURE) return 1;
-  fitsfile.writeSubintRow(block);
-  block.readBlock(fin);
-  fitsfile.writeSubintRow(block);
-  fitsfile.closeFile();
-
-}
-  
Index: unk/src/tests/testTimeFormats.cc
===================================================================
--- /trunk/src/tests/testTimeFormats.cc	(revision 486)
+++ 	(revision )
@@ -1,46 +1,0 @@
-#include <iostream>
-#include <iomanip>
-#include <fstream>
-#include <sstream>
-#include <string>
-#include <vector>
-#include "../pvo-block.hh"
-#include "../pvo-header.hh"
-#include "../pvo-utils.hh"
-
-using namespace Header;
-using namespace Block;
-using std::string;
-using std::vector;
-
-int main(int argc, char * argv[])
-{
-
-  string fname;
-  if(argc==1) fname = "data/s70_tape_test_S181_S18101.dat";
-  else if(argc==2) fname = argv[1];
-
-  DataBlock block(idSurvey(fname));
-  std::ifstream fin;
-  fin.open(fname.c_str(),std::ios::binary);
-  block.readBlock(fin);
-
-  std::cerr << "Filename = " << fname << "\n";
-
-  string ut_strt = block.getKeyword<string>(UT_STRT);
-  std::cerr << "UT_STRT: " << ut_strt << "\n";  
-  std::cerr << "       : " << dmsToDec(ut_strt) << "\n";
-  std::cerr << "       : " << decToDMS(dmsToDec(ut_strt)) << "\n";
-  std::cerr << "       : " << decToDMS(dmsToDec(ut_strt),0,"") << "\n";
-
-  std::cerr << "FITS file :    " << block.getFITSname() << "\n";
-  block.readBlock(fin);
-  std::cerr << "FITS file #2 : " << block.getFITSname() << "\n";
-
-  string date = block.getKeyword<string>(DATE);
-  std::cerr << "DATE: " << date << "\n";    
-  std::cerr << "add a day to DATE : " << addDay(date) << "\n";
-  string newdate = "91/12/31";
-  std::cerr << "add a day to " << newdate << ": " << addDay(newdate) << "\n";
-
-}
Index: /trunk/src/tests/test_pttape_read.cc
===================================================================
--- /trunk/src/tests/test_pttape_read.cc	(revision 1)
+++ /trunk/src/tests/test_pttape_read.cc	(revision 1)
@@ -0,0 +1,156 @@
+#include <iostream>
+#include <sstream>
+#include <fstream>
+#include <iomanip>
+#include <vector>
+#include <string>
+using namespace std;
+
+enum FIELDS 
+{PROGRAM=0, VERSION, TAPENR, FILE_CNTR, BLK_CNTR, DATE, MJD, UT_STRT, LST_STRT, COORD_TYPE,
+ RA_STRT, DEC_STRT, GL_STRT, GB_STRT, FEED_ANGLE, OBS_TIME, COMMENT, NFILTER, CHANBW, NCHAN, FREQ_CHAN1,
+ SAMP_INT, SAMP_GRP, GRP_BLK, BLK_SEC, FDCNTRL, DATA, UT, LST, RA, DEC, GL, GB, TEL_ZEN,
+ TEL_AZ, ATTEN, TPOWER, NBLK_READ, SCAN_RATEL, SCAN_RATEB, NBEAM, IBEAM, PNAME, OBS_FILEN, NBITS, DDM, NDDCH, MOVE,
+ PNTERR, TREE, NSYS, TELID, PANGLE, SMP_BSW, CAL_CYCLE, RESERVE};
+
+const string fieldName[RESERVE+1] = 
+{"PROGRAM", "VERSION", "TAPENR", "FILE_CNTR", "BLK_CNTR", "DATE", "MJD", "UT_STRT", "LST_STRT", "COORD_TYPE",
+" RA_STRT", "DEC_STRT", "GL_STRT", "GB_STRT", "FEED_ANGLE", "OBS_TIME", "COMMENT", "NFILTER", "CHANBW", "NCHAN", "FREQ_CHAN1",
+" SAMP_INT", "SAMP_GRP", "GRP_BLK", "BLK_SEC", "FDCNTRL", "DATA", "UT", "LST", "RA", "DEC", "GL", "GB", "TEL_ZEN",
+" TEL_AZ", "ATTEN", "TPOWER", "NBLK_READ", "SCAN_RATEL", "SCAN_RATEB", "NBEAM", "IBEAM", "PNAME", "OBJS_FILEN", "NBITS", "DDM", "NDDCH", "MOVE",
+" PNTERR", "TREE", "NSYS", "TELID", "PANGLE", "SMP_BSW", "CAL_CYCLE", "RESERVE"};
+
+const int fieldDim[RESERVE+1]={1,1,1,1,1,1,1,1,1,1,
+			 1,1,1,1,1,1,1,1,2,2,2,
+			 2,2,1,1,1,2,1,1,1,1,1,1,1,
+			 1,4,20,1,1,1,1,1,1,1,2,1,2,1,
+			 1,1,1,1,1,1,1,1};
+
+const int fieldSize[RESERVE+1] = {6,4,6,4,8,8,8,16,12,2,
+			    16,16,8,8,8,8,64,2,8,4,12,
+			    12,4,8,8,2,1,16,12,16,16,8,8,8,
+			    8,4,4,8,8,8,4,4,16,16,2,8,4,2,
+			    6,2,2,10,8,8,4,22};
+
+int totalFieldSize[RESERVE+1];
+int fieldStartLoc[RESERVE+1];
+
+inline string getSub(string hdr, int field)
+{return hdr.substr(fieldStartLoc[field],totalFieldSize[field]);};
+			 
+
+int main(int argc, char * argv[])
+{
+  /**
+   *  An attempt to read the binary data from a PTTAPE file
+   *  and write it out in some sensible format...
+   */
+
+  ifstream fin;
+  string filename;
+  if(argc==1){ 
+    filename = "../data/pttape_test";
+  }
+  else if(argc==2){
+    filename = argv[1];
+  }
+  else{
+    cerr << "Either \"pm.x\" or \"pm.x filename\"...\n";
+    return(1);
+  }
+
+  const int HDR_LENGTH=640;     // length of the header in bytes
+  const int DAT_LENGTH=48*1024; // length of the data field in bytes
+
+  for(int i=0;i<=RESERVE;i++) totalFieldSize[i] = fieldDim[i] * fieldSize[i];
+  fieldStartLoc[0] = 0;
+  for(int i=1;i<=RESERVE;i++) fieldStartLoc[i] = fieldStartLoc[i-1] + totalFieldSize[i-1];
+
+  fin.open(filename.c_str(),ios::binary);
+  //   // define and read in the header
+  char *hdr = new char[HDR_LENGTH];
+  fin.read( hdr, HDR_LENGTH*sizeof(char) );
+  string hdrstring = hdr;
+
+  std::cerr << "Header field:\n" << hdr << std::endl;
+  fin.close();
+
+  std::cout << "Header parsing:\n";
+  for(int i=0; i<=RESERVE; i++){
+    std::cout << setw(10) << fieldName[i] << ":\t";
+    //    std::cout << fieldStartLoc[i] << std::endl;
+    std::cout << "[" << setw(3) << fieldStartLoc[i] << "]:\t";
+//     std::cout << hdrstring.substr(fieldStartLoc[i],totalFieldSize[i]) << std::endl;
+    if(getSub(hdrstring,i)[0]!=0) std::cout << getSub(hdrstring,i) << std::endl;
+  }
+
+
+  fin.open(filename.c_str(),ios::binary);
+  // now try and read in the data
+  //  char *data = new char[DAT_LENGTH]; // define data as bool type, which is 
+  vector<char> data;
+  char newone;
+//   while(!fin.eof()) {
+//   for(int i=0;i<DAT_LENGTH;i++){
+//     fin.read( &newone, sizeof(char) );
+//     data.push_back(newone);
+//   }
+
+//   std::cerr << "Data field -- size = " << data.size() << ":\n";
+//   for(int i=0;i<data.size();i++) 
+// //     std::cerr << atoi(&data[i]) << "|" << int(data[i]) <<" ";
+//     if(atoi(&data[i])!=0) 
+//       std::cerr << atoi(&data[i]) << "|" << int(data[i]) <<"|" << data[i] << " ";
+//   std::cerr << std::endl;
+  
+  string fullstring, oldtime = "bob",time;
+  vector<int> changes;
+  vector<float> seconds;
+  for(int loop=0;loop<500;loop++){
+    fin.read( hdr, HDR_LENGTH*sizeof(char) );
+    fullstring = hdr;
+
+    float blk_sec = atof(getSub(fullstring,BLK_SEC).c_str());
+    int grp_blk = atoi( getSub(fullstring,GRP_BLK).c_str() );
+    stringstream ss;
+    ss.str(getSub(fullstring,NCHAN));
+    int nch[2];
+    ss >> nch[0] >> nch[1];
+    time = getSub(fullstring,UT).c_str();
+    if(oldtime != time){
+      std::cerr << setw(3) << loop+1 << ":"
+		<< setw(totalFieldSize[BLK_CNTR]) <<getSub(fullstring,BLK_CNTR)
+		<< setw(totalFieldSize[UT]) << time
+		<< setw(totalFieldSize[RA_STRT]) << getSub(fullstring,RA_STRT)
+		<< setw(totalFieldSize[DEC_STRT]) << getSub(fullstring,DEC_STRT)
+		<< setw(totalFieldSize[RA]) << getSub(fullstring,RA)
+		<< setw(totalFieldSize[DEC]) << getSub(fullstring,DEC)
+		<< setw(totalFieldSize[MOVE]) << getSub(fullstring,MOVE)
+		<< setw(totalFieldSize[IBEAM]) << getSub(fullstring,IBEAM)
+		<< " " << blk_sec / float(grp_blk) 
+		<< " " << 48.*1024.*8. / (nch[0] + nch[1])
+		<< " " << 48.*1024.*8. / (nch[0] + nch[1]) * blk_sec / float(grp_blk) 
+		<< " " << setw(totalFieldSize[MOVE]) << getSub(fullstring,MOVE)
+		<< std::endl;
+      changes.push_back(loop+1);
+      seconds.push_back(atof( fullstring.substr(311,8).c_str() ));
+    }
+      oldtime = time;
+    for(int i=0;i<DAT_LENGTH;i++){
+      fin.read( &newone, sizeof(char) );
+      data.push_back(newone);
+    }
+  }
+
+  cerr << endl << endl;
+
+  for(int i=0;i<changes.size();i++) cerr << setw(3) << changes[i] << " ";
+  cerr << endl;
+  for(int i=1;i<changes.size();i++) cerr << setw(3) << changes[i] - changes[i-1]<< " ";
+  cerr << endl;
+  for(int i=1;i<seconds.size();i++) 
+    cerr << setw(7) << fmodf(seconds[i] - seconds[i-1], 60.)<< " ";
+  cerr << endl;
+
+}
+
Index: /trunk/src/tests/test_s70_data_read.cc
===================================================================
--- /trunk/src/tests/test_s70_data_read.cc	(revision 1)
+++ /trunk/src/tests/test_s70_data_read.cc	(revision 1)
@@ -0,0 +1,158 @@
+#include <iostream>
+#include <sstream>
+#include <fstream>
+#include <iomanip>
+#include <vector>
+#include <string>
+using namespace std;
+
+// Taking the fields from sc_head.inc, which was copied from
+//   /pulsar/psr/cvshome/pulsar/soft_swin_old/soft_swin/search/util/sc_head.inc
+enum FIELDS 
+{SYNCH=0, VERSION, TAPENR, SCAN_CNTR, BLK_CNTR, DATE, MJD, UT_STRT, LST_STRT, COORD_TYPE,
+ RA_STRT, DEC_STRT, GL_STRT, GB_STRT, SCAN_RATE, SCAN_LEN, COMMENT, NFILTER, CHANBW, NCHAN, FREQ_CHAN1,
+ SAMP_INT, SAMP_GRP, GRP_BLK, BLK_SEC, DATA_ONE, UT, LST, RA, DEC, GL, GB, TEL_ZEN,
+ TEL_AZ, STATUS, TPOWER, NBLK_READ, SCAN_RATEL, SCAN_RATEB, BYTE_GRP, IBEAM, PSRNAME, DATA_TWO, OBS_FILEN, NBITS, DDM, NDDCH, MOVE, PNTERR, TREE, NSYS, TELID, NBEAM, RESERVE};
+
+const string fieldName[RESERVE+1] = 
+{"SYNCH", "VERSION", "TAPENR", "SCAN_CNTR", "BLK_CNTR", "DATE", "MJD", "UT_STRT", "LST_STRT", "COORD_TYPE",
+ "RA_STRT", "DEC_STRT", "GL_STRT", "GB_STRT", "SCAN_RATE", "SCAN_LEN", "COMMENT", "NFILTER", "CHANBW", "NCHAN", "FREQ_CHAN1",
+ "SAMP_INT", "SAMP_GRP", "GRP_BLK", "BLK_SEC", "DATA_ONE", "UT", "LST", "RA", "DEC", "GL", "GB", "TEL_ZEN",
+ "TEL_AZ", "STATUS", "TPOWER", "NBLK_READ", "SCAN_RATEL", "SCAN_RATEB", "BYTE_GRP", "IBEAM", "PSRNAME", "DATA_TWO", "OBS_FILEN", "NBITS", "DDM", "NDDCH", "MOVE", "PNTERR", "TREE", "NSYS", "TELID", "NBEAM", "RESERVE"};
+
+const int fieldDim[RESERVE+1]={1,1,1,1,1,1,1,1,1,1,
+			       1,1,1,1,1,1,1,1,2,2,2,
+			       2,2,1,1,1,1,1,1,1,1,1,1,
+			       1,4,8,1,1,1,1,1,1,1,1,2,1,2,1,1,1,1,1,1,1};
+
+const int fieldSize[RESERVE+1] = {8,4,4,4,8,8,8,16,12,2,
+				  16,16,8,8,8,8,64,2,8,4,12,
+				  12,4,8,8,4,16,12,16,16,8,8,8,
+				  8,8,8,8,8,8,4,4,12,4,16,2,8,4,2,6,2,2,10,4,38};
+
+int totalFieldSize[RESERVE+1];
+int fieldStartLoc[RESERVE+1];
+
+inline string getSub(string hdr, int field)
+{return hdr.substr(fieldStartLoc[field],totalFieldSize[field]);};
+			 
+
+int main(int argc, char * argv[])
+{
+  /**
+   *  An attempt to read the binary data from a PTTAPE file
+   *  and write it out in some sensible format...
+   */
+
+  ifstream fin;
+  string filename;
+  if(argc==1){
+    filename = "../data/s70_tape_test_S181_S18101.dat";
+  }
+  else if(argc==2){
+    filename = argv[1];
+  }
+  else{
+    cerr << "Either \"s70.x\" or \"s70.x filename\"...\n";
+    return(1);
+  }
+
+  const int HDR_LENGTH=640;     // length of the header in bytes
+  const int DAT_LENGTH=48*1024; // length of the data field in bytes
+
+  for(int i=0;i<=RESERVE;i++) totalFieldSize[i] = fieldDim[i] * fieldSize[i];
+  fieldStartLoc[0] = 0;
+  for(int i=1;i<=RESERVE;i++) fieldStartLoc[i] = fieldStartLoc[i-1] + totalFieldSize[i-1];
+
+  fin.open(filename.c_str(),ios::binary);
+  // define and read in the header
+  char *hdr = new char[5];
+  fin.read( hdr, 5*sizeof(char) );
+  hdr[4] = '\0';
+  unsigned char compstring[5] = {182, 'm', 'm', 219, 0};
+  if(strcmp((const char*)compstring,hdr)==0)
+    std::cerr << "Yes!\n";
+  else std::cerr << "No!\n";
+  fin.close();
+
+  fin.open(filename.c_str(),ios::binary);
+  // define and read in the header
+  hdr = new char[HDR_LENGTH];
+  fin.read( hdr, HDR_LENGTH*sizeof(char) );
+  string originalHDR(" ",HDR_LENGTH);
+  for(int c=0;c<HDR_LENGTH;c++) originalHDR[c] = hdr[c];
+
+  std::cerr << "Header field:\n" << hdr << std::endl;
+  fin.close();
+
+  std::cerr << "header length = " << originalHDR.size() << std::endl;
+
+  std::cout << "Header parsing:\n";
+  for(int i=0; i<=RESERVE; i++){
+    std::cout << setw(10) << fieldName[i] << " ";
+    std::cout << "[" << setw(3) << fieldStartLoc[i] << "]:\t";
+    if(getSub(originalHDR,i)[0]!=0) std::cout << getSub(originalHDR,i);
+    std::cout << "\n";
+  }
+
+
+  fin.open(filename.c_str(),ios::binary);
+  // now try and read in the data
+  char newone;
+  
+  string fullstring(" ",HDR_LENGTH), oldtime = "bob",time,oldmove="44",move;
+  vector<int> changes;
+  vector<float> seconds;
+  //   for(int loop=0;loop<500;loop++){
+  while(!fin.read( hdr, HDR_LENGTH*sizeof(char) ).eof()){
+    vector<char> data;
+    //    fin.read( hdr, HDR_LENGTH*sizeof(char) );
+    for(int c=0;c<HDR_LENGTH;c++) fullstring[c] = hdr[c];
+
+    float blk_sec = atof(getSub(fullstring,BLK_SEC).c_str());
+    int grp_blk = atoi( getSub(fullstring,GRP_BLK).c_str() );
+    float samp_int = atof( getSub(fullstring,SAMP_INT).c_str() );
+    int samp_grp = atoi( getSub(fullstring,SAMP_GRP).c_str() );
+    stringstream ss;
+    ss.str(getSub(fullstring,NCHAN));
+    int nch[2];
+    ss >> nch[0] >> nch[1];
+    time = getSub(fullstring,UT).c_str();
+    move = atoi( getSub(fullstring,MOVE).c_str() );
+//     if((oldmove!=move) || (oldtime != time)) std::cerr << "\n";
+
+    std::cerr // << setw(3) << loop+1 << ":"
+	      << setw(totalFieldSize[BLK_CNTR]) << getSub(fullstring,BLK_CNTR)
+	      << setw(totalFieldSize[UT]) << time
+	      << setw(totalFieldSize[LST]) << getSub(fullstring,LST)
+	      << setw(totalFieldSize[RA_STRT]) << getSub(fullstring,RA_STRT)
+	      << setw(totalFieldSize[DEC_STRT]) << getSub(fullstring,DEC_STRT)
+	      << setw(totalFieldSize[RA]) << getSub(fullstring,RA)
+	      << setw(totalFieldSize[DEC]) << getSub(fullstring,DEC)
+	      << setw(totalFieldSize[MOVE]) << getSub(fullstring,MOVE)
+	      << setw(totalFieldSize[IBEAM]) << getSub(fullstring,IBEAM)
+	      << setw(totalFieldSize[BLK_SEC]) << getSub(fullstring,BLK_SEC)
+	      << setw(totalFieldSize[GRP_BLK]) << getSub(fullstring,GRP_BLK)
+	      << setw(totalFieldSize[SAMP_INT]) << getSub(fullstring,SAMP_INT)
+	      << setw(totalFieldSize[SAMP_GRP]) << getSub(fullstring,SAMP_GRP);
+// 	      << setw(8) << blk_sec
+// 	      << setw(6) << grp_blk
+// 	      << setw(6) << samp_int
+// 	      << setw(6) << samp_grp;
+//     changes.push_back(loop+1);
+//     seconds.push_back(atof( fullstring.substr(311,8).c_str() ));
+    oldtime = time;
+    oldmove = move;
+    for(int i=0;i<DAT_LENGTH;i++){
+      fin.read( &newone, sizeof(char) );
+      data.push_back(newone);
+    }
+    std::cerr << setw(10) << data.size();
+    std::cerr << std::endl;
+    //     std::cerr << setw(// 4+
+// 		      totalFieldSize[BLK_CNTR]+totalFieldSize[UT]+totalFieldSize[RA_STRT]+totalFieldSize[DEC_STRT]+totalFieldSize[RA]+totalFieldSize[DEC]+totalFieldSize[MOVE]+10+8+6+6+6) << setfill('\b') <<"" << setfill(' ');
+  }
+//   std::cerr << std::endl;
+    
+}
+
Index: /trunk/src/tests/testallheaders.cc
===================================================================
--- /trunk/src/tests/testallheaders.cc	(revision 486)
+++ /trunk/src/tests/testallheaders.cc	(revision 1)
@@ -4,7 +4,7 @@
 #include <sstream>
 #include <string>
-#include "../pvo-block.hh"
-#include "../pvo-header.hh"
-#include "../pvo-utils.hh"
+#include "../Block.hh"
+#include "../Header.hh"
+#include "../Utils.hh"
 
 using namespace Header;
