IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2314


Ignore:
Timestamp:
Nov 8, 2004, 5:45:07 PM (22 years ago)
Author:
Paul Price
Message:

Moved psTimeTable stuff into psLookupTable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/pslib/psLibSDRS.tex

    r2300 r2314  
    1 %%% $Id: psLibSDRS.tex,v 1.146 2004-11-08 00:43:20 eugene Exp $
     1%%% $Id: psLibSDRS.tex,v 1.147 2004-11-09 03:45:07 price Exp $
    22\documentclass[panstarrs,spec]{panstarrs}
    33
     
    17251725    psVector *index;                    ///< Index values
    17261726    psArray *values;                    ///< Corresponding values: an array of vectors
     1727    const char *filename;               ///< File from which table was read
     1728    const psF64 validFrom, validTo;     ///< Range of validity
    17271729} psLookupTable;
    17281730\end{verbatim}
     
    17331735vectors (including the \code{index} and all vectors in the
    17341736\code{values} array) may be any numerical type except complex types.
     1737The \code{filename} shall specify the file from which the table is to
     1738be read.  The \code{validFrom} and \code{validTo} shall specify the
     1739range of valid values for the index; in most cases, these will simply
     1740be the first and last indices.
    17351741
    17361742The constructor shall be:
    17371743\begin{verbatim}
    1738 psLookupTable *psLookupTableAlloc(int numValues);
    1739 \end{verbatim}
    1740 Here the \code{numValues} indicates the number of vectors in the
     1744psLookupTable *psLookupTableAlloc(const char *filename, int numValues);
     1745\end{verbatim}
     1746Here the \const{filename} indicates the file from which the table
     1747shall be read when \code{psLookupTableRead} is
     1748called. \code{numValues} indicates the number of vectors in the
    17411749\code{values} array.
    17421750
     
    17441752
    17451753\begin{verbatim}
    1746 psLookupTable *psLookupTableRead(const char *filename, int numValues);
    1747 \end{verbatim}
    1748 \code{psLookupTableRead} shall read the file specified by
    1749 \code{filename} and import the data into a \code{psLookupTable}.  The
    1750 file shall be plain text, with index and values on separate lines,
    1751 separated by whitespace.  Lines commencing with a comment character
    1752 (the pound sign, \code{#}) and blank lines shall be ignored.
    1753 \code{numValues} in addition to the index shall be read on each line.
    1754 If the \code{index} vector is not sorted in the file, the lookup table
    1755 shall be sorted prior to the function returning, but no sort shall be
    1756 performed if the indices were sorted in the file.
     1754int psLookupTableRead(psLookupTable *table);
     1755\end{verbatim}
     1756\code{psLookupTableRead} shall read the \code{table} from the
     1757appropriate file and import the data into the \code{table}, and set
     1758the \code{validFrom} and \code{validTo} on the basis of the first and
     1759last values in the \code{table}.  Sufficient memory shall be allocated
     1760to hold all the data in the specified file.  The file shall be plain
     1761text, with index and values on separate lines, separated by
     1762whitespace.  Lines commencing with a comment character (the pound
     1763sign, \code{#}) and blank lines shall be ignored.
     1764\code{table->values->n} in addition to the index shall be read on each
     1765line.  If the \code{index} vector is not sorted in the file, the
     1766lookup table shall be sorted prior to the function returning, but no
     1767sort shall be performed if the indices were sorted in the file.  If
     1768the input \code{table} has already been read from a file, the file
     1769shall be re-read, and the contents replaced.  The function shall
     1770return the number of lines read (not including ignored lines).
    17571771
    17581772Interpolation on a lookup table is performed by the following
     
    35203534pre-determined values (\S\ref{sec:timeMetadata}).
    35213535
    3522 We define a structure, \code{psTimeTable} to hold a single time table:
    3523 \begin{verbatim}
    3524 typedef struct {
    3525     const char *filename;               // Filename of time table
    3526     const psF64 validFrom, validTo;     // MJDs of validity of time table
    3527     psLookupTable *table;               // Lookup table indexed on MJD, with UT1-UTC, xp and yp
    3528 } psTimeTable;
    3529 \end{verbatim}
    3530 
    3531 The tables shall be read in only when required by the user (hence the
    3532 \code{loaded} member); once loaded, the table shall remain in memory
    3533 until the termination of the program.  The corresponding constructor
    3534 shall be:
    3535 \begin{verbatim}
    3536 psTimeTable *psTimeTableAlloc(const char *filename, psF64 validFrom, psF64 validTo);
    3537 \end{verbatim}
    3538 which simply constructs a \code{psTimeTable} with the appropriate
    3539 \code{filename}, \code{validFrom} and \code{validTo}.  Upon
    3540 construction, the \code{loaded} member shall be set to \code{false},
    3541 and the vectors containing the data shall be set to \code{NULL}.
    3542 
    3543 The function \code{psTimeTableLoad} shall load a specified time
    3544 \code{table}, returning \code{true} for success, and \code{false} if
    3545 the table failed to load.  If the \code{table} has already been
    3546 loaded, then it shall be re-loaded.
    3547 \begin{verbatim}
    3548 bool psTimeTableLoad(psTimeTable *table);
    3549 \end{verbatim}
    3550 
    3551 %Given a time \code{table} and a Modified Julian Date, \code{mjd}, at
    3552 %which to interpolate values, \code{psTimeTableInterpolate} shall
    3553 %calculate the appropriate UT1-UTC (\code{dut}; if non-\code{NULL}),
    3554 %and polar motion (\code{xp,yp}; if non-\code{NULL}) by interpolation
    3555 %on the table.  If the \code{mjd} is outside the range of the table or
    3556 %the interpolation was for some other reason unsuccessful, then the
    3557 %function shall return \code{false}; otherwise the function shall set
    3558 %those parameters which are non-\code{NULL} (\code{dut,xp,yp}) and
    3559 %return \code{true}.  If the requested \code{mjd} lies in the range of
    3560 %the \code{table}, but the \code{table} has not been \code{loaded},
    3561 %then the function shall call \code{psTimeTableLoad}.
    3562 %\begin{verbatim}
    3563 %bool psTimeTableInterpolate(const psTimeTable *table, double *xp,
    3564 %                            double *yp, double *dut, psF64 mjd);
    3565 %\end{verbatim}
    3566 
    35673536\paragraph{Time Metadata}
    35683537\label{sec:timeMetadata}
Note: See TracChangeset for help on using the changeset viewer.