epnio.h
1/***************************************************************************
2 *
3 * Copyright (C) 2004 by Willem van Straten
4 * Licensed under the Academic Free License version 2.1
5 *
6 ***************************************************************************/
7/*
8 *
9 * epnio.h - defines a C interface to rwepn
10 *
11 * The structs defined in this header file must be a binary match to
12 * the common blocks defined in epnhdr.inc. This includes:
13 *
14 * #define EPN_MAXBLK mmm // where: parameter(maxblk=mmm) in epnhdr.inc
15 *
16 * #define EPN_MAXBIN nnn // where: parameter(maxbin=nnn) in epnhdr.inc
17 *
18 * Willem van Straten - July 2004
19 *
20 */
21
22#ifndef __EPN_IO_H
23#define __EPN_IO_H
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29 /* First line of main header */
30 typedef struct {
31 char version[8];
32 char history[68];
33 int counter;
34 } epn_header_line1;
35
36 /* Second line of main header */
37 typedef struct {
38 char jname[12];
39 char cname[12];
40 double pbar;
41 double dm;
42 double rm;
43 char catref[6];
44 char bibref[8];
45 } epn_header_line2;
46
47 /* Third line of main header */
48 typedef struct {
49 int rah;
50 int ram;
51 int ded;
52 int dem;
53 float ras;
54 float des;
55 char telname[8];
56 double epoch;
57 double opos;
58 char paflag;
59 char timflag;
60 } epn_header_line3;
61
62 /* Fourth line of main header */
63 typedef struct {
64 double xtel, ytel, ztel;
65 } epn_header_line4;
66
67 /* Fifth line of main header */
68 typedef struct {
69 int cdy, cdm, cdd;
70 int scanno, subscan;
71 int npol, nfreq, nbin;
72 double tbin;
73 int nint, ncal, lcal;
74 float fcal;
75 double tres;
76 char fluxflag;
77 } epn_header_line5;
78
79 /* Maximum blocks writing to sub-header... */
80 #define EPN_MAXBLK 16
81
82 /* First line of block sub-header */
83 typedef struct {
84 char idfield[EPN_MAXBLK][8];
85 int nband[EPN_MAXBLK];
86 int navg[EPN_MAXBLK];
87 double f0[EPN_MAXBLK];
88 char f0u[EPN_MAXBLK][8];
89 double df[EPN_MAXBLK];
90 char dfu[EPN_MAXBLK][8];
91 double tstart[EPN_MAXBLK];
92 } epn_block_subheader_line1;
93
94 /* Second line of block sub-header (required to scale/descale data) */
95 typedef struct {
96 double offset[EPN_MAXBLK];
97 double scale[EPN_MAXBLK];
98 double rms[EPN_MAXBLK];
99 double papp[EPN_MAXBLK];
100 } epn_block_subheader_line2;
101
102 /* Maximum number of phase bins... */
103 #define EPN_MAXBIN 4096
104
105 /* Data block */
106 typedef struct {
107 float rawdata[EPN_MAXBLK][EPN_MAXBIN];
108 } epn_data_block;
109
110 /* C wrapper of the Fortran rwepn function */
111 int crwepn ( const char* filename, int readwri, int recno, int padout,
112 epn_header_line1* line1,
113 epn_header_line2* line2,
114 epn_header_line3* line3,
115 epn_header_line4* line4,
116 epn_header_line5* line5,
117 epn_block_subheader_line1* sub_line1,
118 epn_block_subheader_line2* sub_line2,
119 epn_data_block* data );
120
121 /* C wrapper of the Fortran nepnrec function */
122 int cnepnrec (const char* filename);
123
124 void epn_dump (const epn_header_line1* line1,
125 const epn_header_line2* line2,
126 const epn_header_line3* line3,
127 const epn_header_line4* line4,
128 const epn_header_line5* line5);
129
130#ifdef __cplusplus
131}
132#endif
133
134#endif

Generated using doxygen 1.14.0