timer.h
1/***************************************************************************
2 *
3 * Copyright (C) 1999 by Willem van Straten
4 * Licensed under the Academic Free License version 2.1
5 *
6 ***************************************************************************/
7// psrchive/Base/Formats/Timer/timer.h
8
9/* include file for the main timer structure */
10
11/* This has to be compatable with fortran when written as binary to a file.
12 It is *****ABSOLUTELY VITAL***** that eight byte boundaries are not crossed
13 All characters should have a length equal to a multiple of 8
14 In any section of the structure (between character or real*8 declarations)
15 there must be an even number of reals and integers */
16
17/* If you cant do this with actual variables put in pads (eg pad1 below)
18 Space is declared at the end to fill up to 1024 bytes. */
19
20/* If you declare new variables you should subtract the appropriate no of bytes
21 real = 4, integer = 4, real*8 = 8 etc on 32 bit architecture */
22
23/* Dont forget to alter version numbers here and in all programs using this
24 there is a list in header.uses */
25
26#ifndef __TIMER_H
27#define __TIMER_H
28
29/* Polarization storage definitions */
30#define IQ_POLN_STORAGE 1
31#define XY_POLN_STORAGE 0
32
33/* Obstype definitions */
34
35#define FLUX_ON 30
36#define FLUX_OFF 31
37#define HYDRA 20
38#define NHYDRA 21
39#define SHYDRA 22
40#define PULSAR 0
41#define CAL 1
42#define SCAL 2
43
44
45/* A central place for the lengths of the character arrays */
46#define RAM_BOARD_STRLEN 32
47#define CORR_BOARDS_STRLEN 32
48#define MACHINE_ID_STRLEN 8
49#define UTDATE_STRLEN 16
50#define COORD_TYPE_STRLEN 8
51#define PSRNAME_STRLEN 16
52#define TREE_STRLEN 8
53#define TELID_STRLEN 16
54#define TPOVER_STRLEN 8
55#define SCHEDULE_STRLEN 32
56#define COMMENT_STRLEN 64
57#define CALFILE_STRLEN 24
58#define SCALFILE_STRLEN 24
59#define SOFTWARE_STRLEN 128
60#define BACKEND_STRLEN 8
61#define TLABEL_STRLEN 8
62
63/* bit fields in timer.corrected flag (baseband backends) */
64#define RM_ISM_CORRECTED 0x0001 /* interstellar medium rotation measure */
65#define RM_IONO_CORRECTED 0x0002 /* ionospheric rotation measure */
66#define PARA_CORRECTED 0x0004 /* parallactic angle */
67#define FEED_CORRECTED 0x0008 /* feed angle */
68#define DEDISPERSED 0x0010 /* dispersion delays removed */
69#define BE_PHS_CORRECTED 0x0020 /* backend phase convention corrected */
70#define BE_DCC_CORRECTED 0x0040 /* backend downconversion convention corrected */
71
72#define NINT_CORRECTED 0x1000 /* nint bug corrected */
73#define S2ROS_CORRECTED 0x2000 /* S2 ROS time offset corrected */
74
75/* bit fields in timer.calibrated flag
76
77 This interpretation of the calibrated flag was introduced on
78 23-06-2004 by Willem van Straten.
79
80 IMPORTANT NOTE: the first bit is not used in order to distinguish
81 between old timer archives (in which calibrated == 1 implied
82 POLN_CALIBRATED && FLUX_CALIBRATED) and new timer archive (in which
83 one does not necessarily imply the other).
84
85*/
86#define POLN_CALIBRATED 0x0002 /* polarimetric calibration performed */
87#define FLUX_REFERENCE 0x0004 /* flux is in units of reference signal */
88#define FLUX_CALIBRATED 0x0008 /* flux is in Jansky */
89#define FB_CALIBRATED 0x0010 /* filterbank data have been rescaled */
90
91#define RCVR_ID_STRLEN 8
92
93/*
94responsibilities
95(T) timer
96(G) get header
97(A) Archiver
98(C) Tcedar
99(*) After archiver
100*/
101
102/*
103
104NB! At the beginning on an observation each correlator dump
105corresponds to a sub_int. It is only at the archiver stage
106that we get several dumps becoming a sub_int.
107
108*/
109#include <inttypes.h>
110#include "band.h"
111
112struct timer {
113
114/* Basics FPTM info */
115
116 char ram_boards[RAM_BOARD_STRLEN]; /* (G) ID of ram adder boards */
117 char corr_boards[CORR_BOARDS_STRLEN]; /* (G) ID of correlator boards */
118 char machine_id[MACHINE_ID_STRLEN]; /* (T) Machine id Jose=1 */
119 float version; /* (T) Timer version */
120 float minorversion; /* (T) Minor version */
121 int tape_number; /* (*) Tape number of archiver */
122 int file_number; /* (*) file number on tape */
123
124/* Times and references */
125
126 char utdate[UTDATE_STRLEN]; /* (G) dd-mm-yyyy */
127 double fracmjd; /* (G) fractional part of mjd 0.0-0.99999 */
128 int mjd; /* (G) integer part of mjd */
129 int number_of_ticks; /* (G) Ticks between 1pps + int start */
130 double offset; /* (G) diff between 10sec tick and start (ns) */
131 double lst_start; /* (A) seconds */
132
133/* Pulsar Parameters */
134
135 char coord_type[COORD_TYPE_STRLEN]; /* (T) 02=Eq of date, 03=B, 04=Gal, 05=J */
136 char psrname[PSRNAME_STRLEN]; /* (T) Proper name */
137 double ra; /* (T) J2000 ra in radians */
138 double dec; /* (T) J2000 dec in radians */
139 float l; /* (T) Galactic latitude (deg) */
140 float b; /* (T) Galactic longitude (deg) */
141 double nominal_period; /* (G/A) Nominal period of fold (s) */
142 float dm; /* (A) dm */
143 int fold_true_ratio; /* (G/A) Periods across bins 2^nn=0,1... */
144 int nperiods_long; /* (G/A) periods in long int */
145 int nperiods_short; /* (G/A) periods in short int */
146
147/* Observation Configuration */
148
149 int nbin; /* (T/A) bins in profile */
150 float tsmp; /* (G) sampling interval */
151 float sub_int_time; /* (T/A) time for one sub_int */
152 int ndump_sub_int; /* (T/A) dumps per sub_int (1 in timer) */
153 int narchive_int; /* (T) archives per integration */
154 int junk; /* reserved */
155 int nsub_int; /* (T/A) number of sub_ints in an archive
156 at the timer stage this is ndumps in
157 an archive */
158 int junk2; /* reserved */
159 float dump_time; /* (T) time for a dump */
160 int nfreq; /* (T/A) No of RFs (1 or 2) */
161 int nsub_band; /* (A) No of subands across badndwidth */
162 int feedmode; /* (T) 0=const feed angle 1=const pos angle */
163 char tree[TREE_STRLEN]; /* (T) ' ' normal 'T' tree 'D' pdm desip */
164 char telid[TELID_STRLEN]; /* (T) Telescope id (as for tel.def) */
165
166/* Polyco */
167
168 char tpover[TPOVER_STRLEN]; /* (T) tempo version */
169 int nspan; /* (T) minutes polyco for */
170 int ncoeff; /* (T) coefficients in polyco */
171 int nbytespoly; /* (A) nbytes in polyco */
172 int nbytesephem; /* (A) nbytes in ephemeris */
173
174/* Details of each band */
175
176 struct band banda; /* details of band a */
177 struct band bandb; /* " " " b */
178
179/* Misc */
180
181 float rotm; /* Catalogue RM */
182 float rmi; /* Ionospheric RM */
183 float pnterr; /* (T) pointing error in arcseconds */
184 int ibeam; /* (T) Beam # */
185 char tape_label[TLABEL_STRLEN]; /* Tape label */
186
187/* General info and afterthoughts */
188
189 char schedule[SCHEDULE_STRLEN]; /* (T) schedule file used */
190 char comment[COMMENT_STRLEN]; /* (T) comment in schedule file */
191 float pos_angle; /* (T) Feed angle or Posn angle */
192 int headerlength; /* (T) ?? */
193
194 /* baseband backend addition:
195 'corrected' now contains a bitmask of corrections applied.
196 See *_CORRECTED above or access by archive::set/get_corrected()
197 */
198 int corrected; /* (A) 1 if archive is corrected for all bugs */
199
200 int calibrated; /* (C) 1 if archive is calibrated */
201 int obstype; /* (T) see top of this file for list */
202 char calfile[CALFILE_STRLEN]; /* (C) cal archive used for calibration */
203 char scalfile[SCALFILE_STRLEN]; /* (C) scal archive used for calibration */
204 int wts_and_bpass; /* (A) 1 if weights and bandpass are present */
205 int wtscheme; /* (C) weighting scheme used in tcedar */
206
207 char software[SOFTWARE_STRLEN]; /* info on software that produced archive */
208
209 char backend[BACKEND_STRLEN]; /* 8-byte code checked for recognized backend */
210
211 uint32_t be_data_size; /* if backend is recognized, this value is
212 interpreted by archive::load as the number
213 of bytes to skip immediately following the
214 end of the timer header. It is in this
215 space that derived classes of archive
216 should put additional information.
217 DEFINE recognized backend codes in
218 timer++.C */
219
220
221 char rcvr_id[RCVR_ID_STRLEN]; /* (T) Rcvr ID from FCC */
222
223#define TIMER_SPACE 184
224
225 /* NB! SPACE IS ALWAYS THE LAST THING */
226 char space[TIMER_SPACE];
227
228};
229
230#define TIMER_SIZE 1024
231
232#endif

Generated using doxygen 1.14.0