CPSR2File.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2002 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // dspsr/Kernel/Formats/cpsr2/dsp/CPSR2File.h
10 
11 #ifndef __CPSR2File_h
12 #define __CPSR2File_h
13 
14 #include "dsp/File.h"
15 
16 namespace dsp {
17 
18  /*
19  * 2023-Jun-29 - Willem van Straten
20  *
21  * The CPSR2 instrument was decommissioned in 2010 and it is
22  * not recommended to begin any new development using this software.
23  * See the warning in CSPR2File.h for more information.
24  *
25  * The CPSR2 instrument output 16-byte frame headers at the start of
26  * every 2 MB block of data. These frame headers were written *over* data
27  * and not inserted between blocks. At the time, it was thought that
28  * this would have a negligible impact on integrated results, so the samples
29  * over-written by these headers are neither flagged nor skipped.
30  *
31  * Owing to this feature, I would not recommend using the CPSR2 file format
32  * for new development. There are other similarly simple file formats, like
33  * the DADA file format that is built in to dspsr. See
34  *
35  * Kernel/Classes/DADAFile.C
36  *
37  * and
38  *
39  * Kernel/Classes/GenericEightBitUnpacker.C
40  * Kernel/Classes/GenericFourBitUnpacker.C
41  * Kernel/Classes/TwoBitCorrection.C
42  *
43  */
44 
46  class CPSR2File : public File
47  {
48  public:
49 
51  CPSR2File (const char* filename=0);
52 
53  virtual ~CPSR2File();
54 
56  bool is_valid (const char* filename) const;
57 
59  static bool want_to_yamasaki_verify;
60 
62  std::string get_prefix () const;
63 
64  protected:
65 
67  virtual int64_t pad_bytes(unsigned char* buffer, int64_t bytes);
68 
70  virtual void open_file (const char* filename);
71 
73  static int get_header (char* cpsr2_header, const char* filename);
74 
75  std::string prefix;
76  };
77 
78 }
79 
80 #endif // !defined(__CPSR2File_h)
81 
std::string get_prefix() const
return 'm' for cpsr1 and 'n' for cpsr2
Definition: CPSR2File.C:37
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
Loads BitSeries data from a CPSR2 data file.
Definition: CPSR2File.h:51
General means of constructing Observation attributes from CPSR2 data.
Definition: CPSR2_Observation.h:38
CPSR2File(const char *filename=0)
Construct and open file.
Definition: CPSR2File.C:30
bool is_valid(const char *filename) const
Returns true if filename appears to name a valid CPSR2 file.
Definition: CPSR2File.C:71
virtual void open_file(const char *filename)
Open the file.
Definition: CPSR2File.C:85
Loads BitSeries data from file.
Definition: File.h:38
static bool want_to_yamasaki_verify
Set this to 'false' if you don't need to yamasaki verify.
Definition: CPSR2File.h:69
virtual void open(const char *filename)
Open the file.
Definition: File.C:120
uint64_t get_offset_bytes() const
Get the number of bytes offset from the beginning of acquisition.
Definition: ASCIIObservation.h:55
virtual int64_t pad_bytes(unsigned char *buffer, int64_t bytes)
Pads gaps in data.
Definition: CPSR2File.C:124
const float version
The baseband/dsp version number.
Definition: dsp.C:19
static int get_header(char *cpsr2_header, const char *filename)
Read the CPSR2 ascii header from filename.
Definition: CPSR2File.C:42

Generated using doxygen 1.8.17