FadcFile.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2006 by Eric Plum
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 #ifndef __FadcFile_h
10 #define __FadcFile_h
11 
12 #include "dsp/File.h"
13 
14 struct two_bit_out{
15  unsigned lRe :2;
16  unsigned lIm :2;
17  unsigned rRe :2;
18  unsigned rIm :2;
19 };
20 
21 struct four_bit_out{
22  unsigned Re :4;
23  unsigned Im :4;
24 };
25 
26 
27 namespace dsp {
28 
30  class FadcFile : public File
31  {
32  public:
33 
35  FadcFile(const char* filename=0);
36 
38  ~FadcFile ();
39 
41  bool is_valid(const char* filename) const;
42 
43 
44  protected:
45 
47  virtual void open_file (const char* filename);
48 
50  static std::string get_header (const char* filename);
51 
52  // also switches sign of the imaginary values
53  void writeByte(FILE* outfile, two_bit_out two);
54  void writeByte(FILE* outfile, four_bit_out four);
55 
56  int createDataFile(char* expFileName, long firstFile, long lastFile, long* offset_tsmps_file0, long* offset_tsmps, int nbit, int nPol, int nChan, int nADCperCard, long buffers_per_file, long bytes_per_buffer, int expect_magic_code);
57  // offest_tsmps refers to the number of time samples from the beginning of the file (0 and firstFile) where the
58  // usable data starts (i.e. complete time samples that contain measurement data)
59 
60  int read_blockMap(long *buffers_per_file, long *bytes_per_buffer);
61 
62  bool fileExists (char* fileName);
63  uint64_t fileSize(char* fileName);
64  };
65 
66 }
67 #endif // !defined(__FadcFile_h)
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
int createDataFile(char *expFileName, long firstFile, long lastFile, long *offset_tsmps_file0, long *offset_tsmps, int nbit, int nPol, int nChan, int nADCperCard, long buffers_per_file, long bytes_per_buffer, int expect_magic_code)
Definition: FadcFile.C:518
Loads BitSeries data from file.
Definition: File.h:38
~FadcFile()
Destructor.
Definition: FadcFile.C:193
bool is_valid(const char *filename) const
Returns true if filename is a valid Fadc file.
Definition: FadcFile.C:242
Loads BitSeries data from a Fadc file.
Definition: FadcFile.h:30
FadcFile(const char *filename=0)
Construct and open file
Definition: FadcFile.C:181
General means of constructing Observation attributes from FADC data.
Definition: FadcObservation.h:31
static std::string get_header(const char *filename)
Read the Fadc header.
Definition: FadcFile.C:227
virtual void open_file(const char *filename)
Open the file.
Definition: FadcFile.C:307

Generated using doxygen 1.8.17